Ejemplo n.º 1
0
        //animate search bar
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            Toast.MakeText(this, "Top ActionBar pressed: " + item.TitleFormatted, ToastLength.Long).Show();
            switch (item.ItemId)
            {
            case Resource.Id.action_search:
                //search icon has been clicked
                if (isAnimating)
                {
                    return(true);
                }
                else
                {
                    if (animateBool)
                    {
                        editSearch.Visibility = ViewStates.Visible;
                        classSwipeRefresh.Animate().TranslationYBy(editSearchHeight).SetDuration(500).Start();
                        editSearch.Animate().AlphaBy(1.0f).SetDuration(500).Start();
                    }
                    else
                    {
                        classSwipeRefresh.Animate().TranslationYBy(-editSearchHeight).SetDuration(500).Start();
                        editSearch.Animate().AlphaBy(-1.0f).SetDuration(300).Start();
                        editSearch.Visibility = ViewStates.Gone;
                    }
                    animateBool = !animateBool;
                    return(true);
                }

            case Resource.Id.action_addnew:
                FragmentTransaction  transaction          = FragmentManager.BeginTransaction();
                dialog_AddNewAddress addNewAddress_dialog = new dialog_AddNewAddress();
                addNewAddress_dialog.Show(transaction, "dialog fragment");
                //Subscribe to on add new address event
                addNewAddress_dialog.OnAddNewAddressComplete += AddNewAddress_dialog_OnAddNewAddressComplete;
                addNewAddress_dialog.OnAddNewPhotoClick      += AddNewAddress_dialog_OnAddNewPhotoClick;
                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }