Beispiel #1
0
        public override void OnBackPressed()
        {
            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(GravityCompat.Start))
            {
                drawer.CloseDrawer(GravityCompat.Start);
            }
            else
            {
                renderSnackBar("Nu puteti merge la autentificare!");
            }
        }
Beispiel #2
0
        public override void OnBackPressed()
        {
            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(GravityCompat.Start))
            {
                drawer.CloseDrawer(GravityCompat.Start);
            }
            else
            {
                base.OnBackPressed();
            }
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item?.ItemId)
            {
            case Android.Resource.Id.Home:
                if (mainDrawerLayout.IsDrawerOpen(GravityCompat.Start))
                {
                    mainDrawerLayout.CloseDrawer(GravityCompat.Start);
                }
                else
                {
                    mainDrawerLayout.OpenDrawer(GravityCompat.Start);
                }
                break;

            case Resource.Id.CalcExit:
                mainDrawerLayout.CloseDrawer(GravityCompat.Start);
                OnBackPressed();
                break;
            }

            return(base.OnOptionsItemSelected(item));
        }
Beispiel #4
0
 private void OnNavigationClick()
 {
     if (drawerLayout.IsDrawerOpen(GravityCompat.Start))
     {
         drawerLayout.CloseDrawer(GravityCompat.Start);
         if (SupportFragmentManager.BackStackEntryCount > 0)
         {
             SupportActionBar.SetDisplayHomeAsUpEnabled(true);
         }
     }
     else
     {
         if (SupportFragmentManager.BackStackEntryCount > 0)
         {
             this.OnBackPressed();
         }
         else
         {
             drawerLayout.OpenDrawer(GravityCompat.Start);
             toggle.SyncState();
         }
     }
 }
Beispiel #5
0
        public override void OnBackPressed()
        {
            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(GravityCompat.Start))
            {
                drawer.CloseDrawer(GravityCompat.Start);
            }
            else
            {
                Intent i = new Intent(this, typeof(LoginActivity));
                StartActivity(i);
            }
        }
 protected virtual void InitializeEvent()
 {
     FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Click += (s, e) =>
     {
         if (mDrawerLayout.IsDrawerOpen(RLleft_drawer))
         {
             mDrawerLayout.CloseDrawer(RLleft_drawer);
         }
         else
         {
             mDrawerLayout.OpenDrawer(RLleft_drawer);
         }
     };
 }
Beispiel #7
0
        protected override void OnSaveInstanceState(Bundle outState)
        {
            if (mDrawerLayout.IsDrawerOpen((int)GravityFlags.Left))
            {
                outState.PutString("DrawerState", "Opened");
            }

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

            base.OnSaveInstanceState(outState);
        }
        public override void OnBackPressed()
        {
            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(GravityCompat.Start))
            {
                drawer.CloseDrawer(GravityCompat.Start);
            }
            else
            {
                Reproductor.CerrarTodo();
                Finish();
            }
        }
Beispiel #9
0
 //Handling Back Key Press
 public override void OnBackPressed()
 {
     if (drawerLayout.IsDrawerOpen((int)GravityFlags.Start))
     {
         drawerLayout.CloseDrawer((int)GravityFlags.Start);
     }
     else
     {
         new Android.Support.V7.App.AlertDialog.Builder(this)
         .SetIcon(Resource.Drawable.ic_alert)
         .SetTitle("Exiting App")
         .SetMessage("Are you sure you want to exit?")
         .SetPositiveButton("Yes", (c, ev) =>
         {
             CartItems.Clear();
             CartOffers.Clear();
             var activity = (Activity)this;
             activity.FinishAffinity();
         })
         .SetNegativeButton("No", (c, ev) => { })
         .Show();
     }
 }
        //this method handles event for back button press
        public override void OnBackPressed()
        {
            //finds drawer layout, and make it start/close flips it on click of back button
            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(GravityCompat.Start))
            {
                drawer.CloseDrawer(GravityCompat.Start);
            }
            else
            {
                base.OnBackPressed();
            }
        }
Beispiel #11
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);
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            //bitopiApplication = (BitopiApplication)this.ApplicationContext;
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.MyTaskMenuLayout);
            SupportActionBar.SetDisplayShowCustomEnabled(true);
            SupportActionBar.SetCustomView(Resource.Layout.custom_actionbar);
            //LoadDrawerView();
            PushNotificationSingleton.Instance.SaveNotification("");
            FindViewById <RelativeLayout>(Resource.Id.rlSeenTask).Click += (s, e) =>
            {
                Intent i = new Intent(this, typeof(TNAMyTaskActivity));
                bitopiApplication.MyTaskType = MyTaskType.SEEN;
                StartActivity(i);
            };
            FindViewById <RelativeLayout>(Resource.Id.rlUnSeenTask).Click += (s, e) =>
            {
                Intent i = new Intent(this, typeof(TNAMyTaskActivity));
                bitopiApplication.MyTaskType = MyTaskType.UNSEEN;
                StartActivity(i);
            };
            FindViewById <RelativeLayout>(Resource.Id.rlCompleteTask).Click += (s, e) =>
            {
                Intent i = new Intent(this, typeof(TNAMyTaskActivity));
                bitopiApplication.MyTaskType = MyTaskType.COMPLETED;
                StartActivity(i);
            };
            RLleft_drawer = FindViewById <RelativeLayout>(Resource.Id.RLleft_drawer);
            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Visibility = ViewStates.Visible;
            FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Click     += (s, e) =>
            {
                if (mDrawerLayout.IsDrawerOpen(RLleft_drawer))
                {
                    mDrawerLayout.CloseDrawer(RLleft_drawer);
                }
                else
                {
                    mDrawerLayout.OpenDrawer(RLleft_drawer);
                }
            };
            var tvHeaderName = FindViewById <TextView>(Resource.Id.tvHeaderName);

            tvHeaderName.Text = "My Task";
            numberSeen        = FindViewById <TextView>(Resource.Id.numberImageSeen);
            numberUnseen      = FindViewById <TextView>(Resource.Id.numberImageUnseen);
            numberCompleted   = FindViewById <TextView>(Resource.Id.numberImageCompleted);
        }
Beispiel #13
0
        private static bool ViewDrawerIsOpenedGetDefaultValue(View view, IBindingMemberInfo bindingMemberInfo)
        {
            DrawerLayout drawer = FindDrawer(view);

            if (drawer == null)
            {
                IBindingMemberInfo rootMember = BindingServiceProvider.VisualTreeManager.GetRootMember(view.GetType());
                if (rootMember != null)
                {
                    rootMember.TryObserve(view, DrawerInitializer.Instance);
                }
                return(false);
            }
            DrawerListenerImpl.GetOrAdd(drawer);
            return(drawer.IsDrawerOpen(view));
        }
Beispiel #14
0
 public override bool OnOptionsItemSelected(IMenuItem item)
 {
     switch (item.ItemId)
     {
     case Android.Resource.Id.Home:
         if (drawerLayout.IsDrawerOpen(Android.Support.V4.View.GravityCompat.Start))
         {
             drawerLayout.CloseDrawers();
         }
         else
         {
             drawerLayout.OpenDrawer(Android.Support.V4.View.GravityCompat.Start);
         }
         return(true);
     }
     return(base.OnOptionsItemSelected(item));
 }
 public override bool OnOptionsItemSelected(IMenuItem item)
 {
     switch (item.ItemId)
     {
     case 16908332:
         if (drawer.IsDrawerOpen(GravityCompat.Start))
         {
             drawer.CloseDrawer(GravityCompat.Start);
         }
         else
         {
             drawer.OpenDrawer(GravityCompat.Start);
         }
         return(true);
     }
     return(base.OnOptionsItemSelected(item));
 }
        public override void OnBackPressed()
        {
            DrawerLayout drawer = (DrawerLayout)FindViewById(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(v4.View.GravityCompat.Start))
            {
                drawer.CloseDrawer(v4.View.GravityCompat.Start);
            }
            else if (currentNavPosition != Resource.Id.nav_home)
            {
                Navigate(Resource.Id.nav_home);
            }
            else
            {
                base.OnBackPressed();
            }
        }
Beispiel #17
0
 public override void OnBackPressed()
 {
     if (drawerLayout.IsDrawerOpen((int)GravityFlags.Start))
     {
         drawerLayout.CloseDrawer(GravityCompat.Start);
     }
     else
     {
         if (!shouldClose)
         {
             Toast.MakeText(this, "Press back again to exit.", ToastLength.Short).Show();
             shouldClose = true;
             return;
         }
         base.OnBackPressed();
     }
 }
        public override void OnBackPressed()
        {
            FragmentManager fm = FragmentManager;

            Debug.WriteLine("ILOSC FRAGMENTOW NA STOSIE, HALKO " + fm.BackStackEntryCount);
            if (DrawerLayout != null && DrawerLayout.IsDrawerOpen(GravityCompat.Start))
            {
                DrawerLayout.CloseDrawers();
            }
            //else if (fm.BackStackEntryCount > 0)
            //{
            //    fm.PopBackStack();
            //}
            else
            {
                base.OnBackPressed();
            }
        }
Beispiel #19
0
 public override bool OnOptionsItemSelected(IMenuItem item)
 {
     Mvx.Trace("MainListView:OnOptionsItemSelected item = " + item.ToString());
     //Mvx.Trace("itemId = " + item.ItemId);
     //Mvx.Trace("Android.Resource.Id.Home = " + Android.Resource.Id.Home);
     if (item != null && item.ItemId == Android.Resource.Id.Home)
     {
         if (_drawerLayout.IsDrawerOpen(3))
         {
             _drawerLayout.CloseDrawer(3);
         }
         else
         {
             _drawerLayout.OpenDrawer(3);
         }
     }
     return(base.OnOptionsItemSelected(item));
 }
Beispiel #20
0
        public override void OnBackPressed()
        {
            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(GravityCompat.Start))
            {
                drawer.CloseDrawer(GravityCompat.Start);
            }
            else
            {
                if (SupportFragmentManager.BackStackEntryCount == 1)
                {
                    SupportFragmentManager.PopBackStackImmediate();
                }
                base.OnBackPressed();
                SetSelectedMenuItem();
            }
        }
Beispiel #21
0
        public override void OnBackPressed()
        {
            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(GravityCompat.Start))
            {
                drawer.CloseDrawer(GravityCompat.Start);
            }
            else if (lastFragments.Count > 0)
            {
                ChangeFragment(lastFragments.Last());
                lastFragments.Remove(lastFragments.Last());
            }
            else
            {
                base.OnBackPressed();
            }
        }
Beispiel #22
0
        public override void OnBackPressed()
        {
            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(GravityCompat.Start))
            {
                drawer.CloseDrawer(GravityCompat.Start);
                return;
            }

            if (viewFlipper.DisplayedChild != Constants.Views.Dashboard)
            {
                viewFlipper.DisplayedChild = Constants.Views.Dashboard;
                return;
            }

            base.OnBackPressed();
        }
Beispiel #23
0
        public override void OnBackPressed()
        {
            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(GravityCompat.Start))
            {
                drawer.CloseDrawer(GravityCompat.Start);
            }
            else
            {
                FragmentManager fm = FragmentManager;
                if (fm.BackStackEntryCount > 0)
                {
                    // Log.i("MainActivity", "popping backstack");
                    // fm.PopBackStack();
                }
                else
                {
                    Fragment myFragment  = FragmentManager.FindFragmentByTag("MainFrag");
                    Fragment myFragment1 = FragmentManager.FindFragmentByTag("CreateTaskFrag");
                    Fragment myFragment2 = FragmentManager.FindFragmentByTag("TaskInboxFrag");
                    Fragment myFragment3 = FragmentManager.FindFragmentByTag("TaskOutboxFrag");
                    if (fm.FindFragmentByTag("MainFrag") != null && fm.FindFragmentByTag("MainFrag").IsVisible)
                    {
                        this.RunOnUiThread(
                            async() =>
                        {
                            var isCloseApp = await AlertAsync(this, "Task", "Do you want to close this app? if you will close the app data will be  lost.", "Yes", "No");

                            if (isCloseApp)
                            {
                                this.FinishAffinity();
                            }
                        });
                    }
                    else
                    {
                        base.OnBackPressed();
                    }
                    //  Log.i("MainActivity", "nothing on backstack, calling super");
                    //   base.onBackPressed();
                }
            }
        }
Beispiel #24
0
 public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
 {
     if (SupportFragmentManager.BackStackEntryCount > 0)
     {
         OnBackPressed();
     }
     else
     {
         if (drawerLayout.IsDrawerOpen(GravityCompat.Start))
         {
             drawerLayout.CloseDrawers();
         }
         else
         {
             drawerLayout.OpenDrawer(GravityCompat.Start);
         }
     }
     return(true);
 }
Beispiel #25
0
        /// <summary>
        /// Overriden method for handling Home button for left drawer menu.
        /// </summary>
        /// <param name="item">Seleected menu item.</param>
        /// <returns>True if selected menu item was processed or not.</returns>
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            // handle Home button in this activity for closing and opening menu drawer
            if (item.ItemId == global::Android.Resource.Id.Home)
            {
                if (_drawerLayout.IsDrawerOpen((int)GravityFlags.Left))
                {
                    _drawerLayout.CloseDrawer((int)GravityFlags.Left);
                }
                else
                {
                    _drawerLayout.OpenDrawer((int)GravityFlags.Left);
                }

                return(true);
            }

            return(base.OnOptionsItemSelected(item));
        }
Beispiel #26
0
        //when the actionbar drawer toggle to click
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            int i = item.ItemId;

            if (i == Android.Resource.Id.Home)
            {
                //checking if the drawer is already opened
                if (drawer1.IsDrawerOpen(GravityCompat.Start))
                {
                    drawer1.CloseDrawers();
                }
                //otherwise
                else
                {
                    drawer1.OpenDrawer(GravityCompat.Start);
                }
            }
            return(base.OnOptionsItemSelected(item));
        }
Beispiel #27
0
        public override void OnBackPressed()
        {
            if (drawerLayout?.IsDrawerOpen((int)GravityFlags.Start) ?? false)
            {
                drawerLayout.CloseDrawers();
                return;
            }

            var manager = FragmentManager;

            if (manager.BackStackEntryCount > 1)
            {
                manager.PopBackStack();
            }
            else
            {
                base.OnBackPressed();
            }
        }
Beispiel #28
0
        public override void OnBackPressed()
        {
            if (BackStackHandler.PopCall())
            {
                base.OnBackPressed();
                return;
            }

            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(GravityCompat.Start))
            {
                drawer.CloseDrawer(GravityCompat.Start);
            }
            else
            {
                base.OnBackPressed();
            }
        }
Beispiel #29
0
        public override void OnBackPressed()
        {
            if (NavDrawerLayout.IsDrawerOpen(GravityCompat.Start))
            {
                NavDrawerLayout.CloseDrawer(GravityCompat.Start);
            }
            else
            {
                int count = SupportFragmentManager.BackStackEntryCount;

                if (count > 0)
                {
                    SupportFragmentManager.PopBackStack();
                }
                else
                {
                    base.OnBackPressed();
                }
            }
        }
Beispiel #30
0
        public override void OnBackPressed()
        {
            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            if (drawer.IsDrawerOpen(GravityCompat.Start))
            {
                drawer.CloseDrawer(GravityCompat.Start);
            }
            else
            {
                if (FindViewById(Resource.Id.mainFragment).GetType() != typeof(Fragment_Tabacco_list))
                {
                    ShowTabaccoHome();
                }
                else
                {
                    base.OnBackPressed();
                }
            }
        }