public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.addToFavorites:
                recipe.IsFavorite = !recipe.IsFavorite;
                SetFavoriteDrawable(recipe.IsFavorite);
                break;

            case Resource.Id.about:
                StartActivity(typeof(AboutActivity));
                break;

            case Android.Resource.Id.Home:
                Finish();
                break;

            case Resource.Id.oneServing: SetServings(1); item.SetChecked(true); break;

            case Resource.Id.twoServings: SetServings(2); item.SetChecked(true); break;

            case Resource.Id.fourServings: SetServings(4); item.SetChecked(true); break;
            }

            return(true);
        }
Пример #2
0
        void SwapFragmentForMenuItem(Android.Views.IMenuItem item)
        {
            // set item selected in the navigation
            item.SetChecked(true);

            switch (item.ItemId)
            {
            case Resource.Id.nav_posts:
                ShowFragment(new PostsFragment());
                break;

            default: break;
            }
        }