Esempio n. 1
0
 public void CloseDrawer()
 {
     if (drawer.IsDrawerOpen(GravityCompat.Start))
     {
         drawer.CloseDrawer(GravityCompat.Start);
     }
 }
Esempio n. 2
0
        public override bool OnPrepareOptionsMenu(IMenu menu)
        {
            // If the nav drawer is open, hide action items related to the content view
            bool drawerOpen = mDrawerLayout.IsDrawerOpen(mDrawerList);

            menu.FindItem(Resource.Id.action_websearch).SetVisible(!drawerOpen);
            return(base.OnPrepareOptionsMenu(menu));
        }
Esempio n. 3
0
        public override void OnBackPressed()
        {
            if (drawerLayout.IsDrawerOpen(Android.Support.V4.View.GravityCompat.Start))
            {
                drawerLayout.CloseDrawers();
            }

            else
            {
                base.OnBackPressed();
            }
        }
        protected override void OnSaveInstanceState(Bundle outState)
        {
            if (mDrawerLayout.IsDrawerOpen((int)GravityFlags.Left))
            {
                outState.PutString("DrawerState", "Opened");
            }

            else
            {
                outState.PutString("DrawerState", "Closed");
            }

            base.OnSaveInstanceState(outState);
        }
Esempio n. 5
0
        //Snackbar preventing accidental exit
        public override void OnBackPressed()
        {
            if (drawerLayout.IsDrawerOpen(GravityCompat.Start))
            {
                drawerLayout.CloseDrawers();
            }

            else
            {
                Snackbar snackbar = Snackbar.Make((View)cameraSurfaceView, "Use the home button to exit", Snackbar.LengthShort);
                Snackbar.SnackbarLayout layout = (Snackbar.SnackbarLayout)snackbar.View;    //get the snackbar layout
                layout.SetMinimumHeight(110);
                layout.SetBackgroundColor(Android.Graphics.Color.DarkOrange);

                TextView snackbarTextView = snackbar.View.FindViewById <TextView>(Resource.Id.snackbar_text);   //change text size
                snackbarTextView.SetTextSize(Android.Util.ComplexUnitType.Dip, 29);                             //

                snackbar.Show();
            }
        }
Esempio n. 6
0
        public override void OnBackPressed()
        {
            if (sidem.IsDrawerOpen(Android.Support.V4.View.GravityCompat.Start))
            {
                sidem.CloseDrawers();
            }
            else
            {
                if (estado == 0)
                {
                    new Thread(() =>
                    {
                        selectedconsole = 0;
                        cargarconsolas();
                    }).Start();
                }
                else
                if (estado == 4)
                {
                    new Thread(() =>
                    {
                        cargaremuladores();
                    }).Start();
                }
                else
                {
                    if (presionadounavez)
                    {
                        Finish();
                    }
                    else
                    {
                        presionadounavez = true;
                        Toast.MakeText(this, "Pulse otra vez para salir", ToastLength.Short).Show();
                        new Handler().PostDelayed(new RunnableHelper(), 2000);
                    }
                }
            }

            // base.OnBackPressed();
        }