public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (toggle.DrawerIndicatorEnabled && toggle.OnOptionsItemSelected((Android.Views.IMenuItem)item))
            {
                return(true);
            }

            if (item.ItemId == Android.Resource.Id.Home)
            {
                SupportFragmentManager.PopBackStackImmediate();

                return(true);
            }

            switch (item.ItemId)
            {
            case (SWAP_MENU):
                App.STATE.SwapLanguage();
                return(true);

            case (PINYIN_MENU):
                App.STATE.PinyinToggleParadigm();
                return(true);

            case (SYNC_MENU):
                App.FUNCTIONS.UserSyncDialog(this);
                return(true);

            case (SETTINGS_MENU):
                StartActivity(typeof(SettingsActivity));
                return(true);
            }

            return(base.OnOptionsItemSelected(item));
        }
Beispiel #2
0
 /// <summary>
 /// handles menu actions
 /// </summary>
 /// <param name="item">the item of the menu that was selected</param>
 /// <returns></returns>
 public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
 {
     if (item.ItemId == Resource.Id.topScores)
     {
         Intent intent = new Intent(this, typeof(TopScoresActivity));
         intent = score.SetScoreInIntent(intent);
         StartActivityForResult(intent, TOP_SCORES_CODE);
         return(true);
     }
     if (item.ItemId == Resource.Id.settings)
     {
         CreateSettingsDialog();
         return(true);
     }
     if (item.ItemId == Resource.Id.customize)
     {
         Intent intent = new Intent(this, typeof(CustomizeActivity));
         StartActivityForResult(intent, CUSTOMIZE_CODE);
         return(true);
     }
     if (item.ItemId == Resource.Id.help)
     {
         CreateHelpDialog();
         return(true);
     }
     return(base.OnOptionsItemSelected(item));
 }
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.menu_settings:

                var intent = new Intent(this, typeof(SettingsActivity));
                StartActivity(intent);

                return(true);

            case Resource.Id.menu_history:
                var intent2 = new Intent(this, typeof(HistoryActivity));
                StartActivity(intent2);
                return(true);

            case Resource.Id.menu_share:
                var intent3 = new Intent(Intent.ActionSend);
                intent3.PutExtra(Intent.ExtraText, string.Format(Resources.GetString(Resource.String.share_steps_today), stepCount.Text));
                intent3.SetType("text/plain");
                StartActivity(Intent.CreateChooser(intent3, Resources.GetString(Resource.String.share_steps_on)));

                return(true);
            }
            return(base.OnOptionsItemSelected(item));
        }
Beispiel #4
0
        void BottomNavigationView_NavigationItemSelected(object sender, BottomNavigationView.NavigationItemSelectedEventArgs e)
        {
            var bottomNavMenuView = bottomNavigationView.GetChildAt(0) as BottomNavigationMenuView;
            var normalColor       = tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().GetBarItemColor().ToAndroid();
            var selectedColor     = tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().GetBarSelectedItemColor().ToAndroid();

            // nếu cái trước đó có, thì set về bình thường.
            if (lastItemSelected != null)
            {
                lastItemSelected.Icon.SetColorFilter(normalColor, PorterDuff.Mode.SrcIn);
            }

            // sau đó sét selected và set cái lần này là cái cuối cùng.
            e.Item.Icon.SetColorFilter(selectedColor, PorterDuff.Mode.SrcIn);
            lastItemSelected = e.Item;
            //if ($"{e.Item}" != "SimHere")
            //{
            //    e.Item.Icon.SetColorFilter(selectedColor, PorterDuff.Mode.SrcIn);
            //    lastItemSelected = e.Item;
            //}

            if (lastItemId != -1)
            {
                SetTabItemTextColor(bottomNavMenuView.GetChildAt(lastItemId) as BottomNavigationItemView, normalColor);
            }

            SetTabItemTextColor(bottomNavMenuView.GetChildAt(e.Item.ItemId) as BottomNavigationItemView, selectedColor);


            SetupBottomNavigationView(e.Item);
            this.OnNavigationItemSelected(e.Item);

            lastItemId = e.Item.ItemId;
        }
Beispiel #5
0
        void BottomNavigationView_NavigationItemSelected(object sender, BottomNavigationView.NavigationItemSelectedEventArgs e)
        {
            var bottomNavMenuView = bottomNavigationView.GetChildAt(0) as BottomNavigationMenuView;
            var normalColor       = tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().GetBarItemColor().ToAndroid();
            var selectedColor     = tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().GetBarSelectedItemColor().ToAndroid();

            if (lastItemSelected != null)
            {
                lastItemSelected.Icon.SetColorFilter(normalColor, PorterDuff.Mode.SrcIn);
            }

            if ($"{e.Item}" != "App")
            {
                e.Item.Icon.SetColorFilter(selectedColor, PorterDuff.Mode.SrcIn);
                lastItemSelected = e.Item;
            }

            if (lastItemId != -1)
            {
                SetTabItemTextColor(bottomNavMenuView.GetChildAt(lastItemId) as BottomNavigationItemView, normalColor);
            }

            SetTabItemTextColor(bottomNavMenuView.GetChildAt(e.Item.ItemId) as BottomNavigationItemView, selectedColor);


            SetupBottomNavigationView(bottomNavigationView, e.Item);
            this.OnNavigationItemSelected(e.Item);

            lastItemId = e.Item.ItemId;
        }
 public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
 {
     if (item.ItemId == (int)Keycode.Home)
     {
         return(false);
     }
     return(true);
 }
Beispiel #7
0
 /// <summary>
 /// Allows to choose the items in the menu
 /// </summary>
 /// <param name="item">the menu</param>
 /// <returns></returns>
 public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
 {
     if (item.ItemId == Resource.Id.action_settings)
     {
         CreateSettingsDialog();
     }
     return(base.OnOptionsItemSelected(item));
 }
Beispiel #8
0
 public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
 {
     if (item.ItemId == Android.Resource.Id.Home)
     {
         Finish(); return(true);
     }
     return(base.OnOptionsItemSelected(item));
 }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (this.drawerToggle.OnOptionsItemSelected(item))
            {
                return(true);
            }

            return(false);
        }
        public bool OnMenuItemActionCollapse(Android.Views.IMenuItem item)
        {
            if (Mode != Mode.None)
            {
                OnBackPressed();
            }

            return(true);
        }
Beispiel #11
0
 /// <summary>
 /// Creates the menu and inflates it
 /// </summary>
 /// <param name="menu">the menu created</param>
 /// <returns></returns>
 public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
 {
     MenuInflater.Inflate(Resource.Menu.menu, menu);
     for (int i = 0; i < menu.Size(); i++)
     {
         Android.Views.IMenuItem item = menu.GetItem(i);
         item.SetShowAsAction(Android.Views.ShowAsAction.Always);
     }
     return(base.OnCreateOptionsMenu(menu));
 }
Beispiel #12
0
 public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
 {
     switch (item.ItemId)
     {
     case Android.Resource.Id.Home:
         Finish();
         break;
     }
     return(true);
 }
Beispiel #13
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case MENU_MAP_ID:
                ViewModel?.MapCommand.Execute(null);
                return(base.OnOptionsItemSelected(item));
            }

            return(base.OnOptionsItemSelected(item));
        }
Beispiel #14
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.action_add:
                CreateNewItem();
                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
Beispiel #15
0
        public override bool OnContextItemSelected(Android.Views.IMenuItem item)
        {
            if (item.ItemId == Resource.Id.Play_Menu)
            {
                FinishAffinity(); // Removing The Activity History. ( All The Activitys That Were Open, No Longer Exist )

                // Moving The User To The Play Manu Activity.
                Intent[] Intent = new Intent[] { new Intent(this, typeof(Main_Menu_Activity)), new Intent(this, typeof(Play_Menu)) };

                // Changing To The Next Activity.
                StartActivities(Intent);

                return(true);
            }
            else if (item.ItemId == Resource.Id.Top10_Menu)
            {
                FinishAffinity(); // Removing The Activity History. ( All The Activitys That Were Open, No Longer Exist )

                // Moving The User To The Top10 Manu Activity.
                Intent[] Intent = new Intent[] { new Intent(this, typeof(Main_Menu_Activity)), new Intent(this, typeof(Top10_Menu_Activity)) };

                // Changing To The Next Activity.
                StartActivities(Intent);

                return(true);
            }
            else if (item.ItemId == Resource.Id.Game_Instructions)
            {
                FinishAffinity(); // Removing The Activity History. ( All The Activitys That Were Open, No Longer Exist )

                // Moving The User To The Game Instructions Activity.
                Intent[] Intent = new Intent[] { new Intent(this, typeof(Main_Menu_Activity)), new Intent(this, typeof(Game_Instructions_Activity)) };

                // Changing To The Next Activity.
                StartActivities(Intent);

                return(true);
            }
            else if (item.ItemId == Resource.Id.Dialog)
            {
                Dialog Dialog = new Dialog(this);

                Dialog.SetContentView(Resource.Layout.custom_dialog);
                Dialog.SetCancelable(true);

                Dialog.Show();

                return(true);
            }

            return(false);
        }
Beispiel #16
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                drawerLayout.OpenDrawer((int)GravityCompat.Start);
                break;

            default:
                break;
            }
            return(base.OnOptionsItemSelected(item));
        }
Beispiel #17
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.item1:

                StartActivity(intenti);
                return(true);

            default:
                return(false);
            }
        }
Beispiel #18
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.enter_results: {
                (ViewModel as QuestionsViewModel).Questions[viewPager.CurrentItem].EnterResults();
                return(true);
            }

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
Beispiel #19
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                this.OnBackPressed();
                break;

            default:
                break;
            }
            return(base.OnOptionsItemSelected(item));
        }
Beispiel #20
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            // No action on same item pressed
            if (_previousMenuItem != null && item.ItemId == _previousMenuItem.ItemId)
            {
                return(false);
            }

            _previousMenuItem = item;

            Navigate(item.ItemId);

            return(true);
        }
Beispiel #21
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.cartMain:
                StartActivity(typeof(ShoppingCartActivity));
                break;

            case Android.Resource.Id.Home:
                mainDrawerLayout.OpenDrawer(GravityCompat.Start);
                break;
            }
            return(true);
        }
Beispiel #22
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.refresh:
                Clear();
                xamLogo.TranslationX = xamLogo.TranslationY = 0;
                break;

            default:
                break;
            }

            return(base.OnOptionsItemSelected(item));
        }
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            // Handle action bar item clicks here. The action bar will
            // automatically handle clicks on the Home/Up button, so long
            // as you specify a parent activity in AndroidManifest.xml.
            int id = item.ItemId;

            //noinspection SimplifiableIfStatement
            if (id == Resource.Id.action_settings)
            {
                return(true);
            }

            return(base.OnOptionsItemSelected(item));
        }
Beispiel #24
0
 public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
 {
     if (item.ItemId == Android.Resource.Id.Home)
     {
         if (drawerLayout.IsDrawerOpen(GravityCompat.Start))
         {
             drawerLayout.CloseDrawer(GravityCompat.Start);
         }
         else
         {
             drawerLayout.OpenDrawer(GravityCompat.Start);
         }
     }
     return(true);
 }
Beispiel #25
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.menu_action_refresh:
                refreshItem = item;
                refresh();
                break;

            case Resource.Id.menu_action_send:
                sendMessageToWearAsync();
                break;
            }
            return(true);
        }
Beispiel #26
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            // switch the menu item click and handle accordingly
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                OnBackPressed();
                return(true);

            case Resource.Id.action_done:
                vm.CommitNewItem();
                Finish();
                break;
            }
            return(base.OnOptionsItemSelected(item));
        }
Beispiel #27
0
        void BottomNavigationView_NavigationItemSelected(object sender, BottomNavigationView.NavigationItemSelectedEventArgs e)
        {
            var bottomNavMenuView = bottomNavigationView.GetChildAt(0) as BottomNavigationMenuView;
            var normalColor       = tabbedPage.UnselectedTabColor.ToAndroid();
            var selectedColor     = tabbedPage.SelectedTabColor.ToAndroid();

            if (lastItemSelected != null)
            {
                lastItemSelected.Icon.SetColorFilter(normalColor, PorterDuff.Mode.SrcIn);
            }

            if ($"{e.Item}" != "Home")
            {
                e.Item.Icon.SetColorFilter(selectedColor, PorterDuff.Mode.SrcIn);

                var icon = bottomNavigationView.Menu.GetItem(0).Icon;
                if (icon != null)
                {
                    icon = Android.Support.V4.Graphics.Drawable.DrawableCompat.Wrap(icon);
                    icon.SetColorFilter(tabbedPage.UnselectedTabColor.ToAndroid(), PorterDuff.Mode.SrcIn);
                }

                lastItemSelected = e.Item;
            }
            else
            {
                var icon = bottomNavigationView.Menu.GetItem(0).Icon;
                if (icon != null)
                {
                    icon = Android.Support.V4.Graphics.Drawable.DrawableCompat.Wrap(icon);
                    icon.SetColorFilter(tabbedPage.SelectedTabColor.ToAndroid(), PorterDuff.Mode.SrcIn);
                }
            }

            if (lastItemId != -1)
            {
                SetTabItemTextColor(bottomNavMenuView.GetChildAt(lastItemId) as BottomNavigationItemView, normalColor);
            }

            SetTabItemTextColor(bottomNavMenuView.GetChildAt(e.Item.ItemId) as BottomNavigationItemView, selectedColor);

            SetupBottomNavigationView(e.Item);
            this.OnNavigationItemSelected(e.Item);

            lastItemId = e.Item.ItemId;
        }
Beispiel #28
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.CartItems:
                string em  = Intent.GetStringExtra("Email");
                string pss = Intent.GetStringExtra("Password");

                intent.PutExtra("Email", em);
                intent.PutExtra("Password", pss);
                StartActivity(intent);
                return(true);


            default:
                return(false);
            }
        }
Beispiel #29
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            if (item.ItemId == Resource.Id.action_notification)
            {
                notificationFrame.Visibility = ViewStates.Visible;
                float initialX = -(notificationFrame.Left + notificationFrame.Width + notificationFrame.PaddingLeft);
                notificationFrame.TranslationX = initialX;
                ViewCompat.Animate(notificationFrame)
                .TranslationX(0)
                .SetDuration(600)
                .SetStartDelay(100)
                .SetInterpolator(new Android.Support.V4.View.Animation.LinearOutSlowInInterpolator())
                .Start();

                return(true);
            }
            return(base.OnOptionsItemSelected(item));
        }
Beispiel #30
0
        public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.login_id:
                var intent = new Intent(this, typeof(LoginActivity));
                StartActivity(intent);
                return(true);

            case Resource.Id.reg_id:
                var intents = new Intent(this, typeof(RegistrationActivity));
                StartActivity(intents);
                return(true);

            default:
                return(false);
            }
        }