public void OnCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, bool isChecked)
 {
     if (drawerItem is INameable) {
     Log.Info("material-drawer", "DrawerItem: " + ((INameable) drawerItem).Name + " - toggleChecked: " + isChecked);
       } else {
     Log.Info("material-drawer", "toggleChecked: " + isChecked);
       }
 }
Esempio n. 2
0
            public void OnBindView(IDrawerItem p0, View p1)
            {
                var view = p1.FindViewById(123098);

                if (view != null)
                {
                    view.Visibility = ViewStates.Gone;
                }
            }
Esempio n. 3
0
        private void OnHamburgerItemClick(View view, int i, IDrawerItem arg3)
        {
            //if (page == PageIndex.PageProfile)
            // ViewModelLocator.NavMgr.RegisterBackNav(PageIndex.PageAnimeList, null);
            var page = (PageIndex)arg3.Identifier;

            ViewModelLocator.GeneralMain.Navigate(page, GetAppropriateArgsForPage(page));
            _drawer.SetSelection(arg3, false);
            _drawer.CloseDrawer();
        }
Esempio n. 4
0
        private void OnHamburgerItemClick(View view, int i, IDrawerItem arg3)
        {
            if (!_allowHamburgerNavigation)
            {
                return;
            }

            OnHamburgerItemClick((PageIndex)arg3.Identifier);
            _drawer.SetSelection(arg3, false);
        }
 public void OnCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, bool isChecked)
 {
     if (drawerItem is INameable)
     {
         Log.Info("material-drawer", "DrawerItem: " + ((INameable)drawerItem).Name + " - toggleChecked: " + isChecked);
     }
     else
     {
         Log.Info("material-drawer", "toggleChecked: " + isChecked);
     }
 }
Esempio n. 6
0
            public void OnBindView(IDrawerItem p0, View p1)
            {
                p1.SetPadding(DimensionsHelper.DpToPx(16), 0, 0, 0);

                var frame = p1.FindViewById(123098);

                if (frame != null)
                {
                    if (p0.Tag != null)
                    {
                        frame.Visibility = ViewStates.Visible;
                    }
                    else
                    {
                        frame.Visibility = ViewStates.Gone;
                    }

                    frame.SetOnClickListener(new OnClickListener(_moreButtonAction));

                    return;
                }
                if (p0.Tag == null)
                {
                    return;
                }

                var param = new LinearLayout.LayoutParams(DimensionsHelper.DpToPx(50), -1);

                param.SetMargins(DimensionsHelper.DpToPx(10), 0, 0, 0);

                var view = new FrameLayout(p1.Context)
                {
                    Clickable        = true,
                    Focusable        = true,
                    Id               = 123098,
                    LayoutParameters = param
                };

                view.SetBackgroundResource(ResourceExtension.SelectableBorderlessItemBackground);
                var img = new ImageView(p1.Context);

                img.SetScaleType(ImageView.ScaleType.Center);
                img.SetImageResource(Resource.Drawable.icon_more_vertical);
                img.ImageTintList = global::Android.Content.Res.ColorStateList.ValueOf(new Color(ResourceExtension.BrushText));

                view.AddView(img);

                view.SetOnClickListener(new OnClickListener(_moreButtonAction));

                (p1 as ViewGroup).AddView(view);
            }
        public bool OnItemClick(View view, int position, IDrawerItem drawerItem)
        {
            //check if the drawerItem is set.
            //there are different reasons for the drawerItem to be null
            //--> click on the header
            //--> click on the footer
            //those items don't contain a drawerItem

            if (drawerItem != null)
            {
            }

            return(false);
        }
        public bool OnItemClick(AdapterView parent, View view, int position, long id, IDrawerItem drawerItem)
        {
            //check if the drawerItem is set.
              //there are different reasons for the drawerItem to be null
              //--> click on the header
              //--> click on the footer
              //those items don't contain a drawerItem

              if (drawerItem != null) {
            //        Intent intent = null;
            //        if (drawerItem.Identifier == 1) {
            //          intent = new Intent(SimpleHeaderDrawerActivity.this, SimpleCompactHeaderDrawerActivity.class);
            //        } else if (drawerItem.getIdentifier() == 2) {
            //          intent = new Intent(SimpleHeaderDrawerActivity.this, ActionBarDrawerActivity.class);
            //        } else if (drawerItem.getIdentifier() == 3) {
            //          intent = new Intent(SimpleHeaderDrawerActivity.this, MultiDrawerActivity.class);
            //        } else if (drawerItem.getIdentifier() == 4) {
            //          intent = new Intent(SimpleHeaderDrawerActivity.this, SimpleNonTranslucentDrawerActivity.class);
            //        } else if (drawerItem.getIdentifier() == 5) {
            //          intent = new Intent(SimpleHeaderDrawerActivity.this, ComplexHeaderDrawerActivity.class);
            //        } else if (drawerItem.getIdentifier() == 6) {
            //          intent = new Intent(SimpleHeaderDrawerActivity.this, SimpleFragmentDrawerActivity.class);
            //        } else if (drawerItem.getIdentifier() == 7) {
            //          intent = new Intent(SimpleHeaderDrawerActivity.this, EmbeddedDrawerActivity.class);
            //        } else if (drawerItem.getIdentifier() == 8) {
            //          intent = new Intent(SimpleHeaderDrawerActivity.this, FullscreenDrawerActivity.class);
            //        } else if (drawerItem.getIdentifier() == 9) {
            //          intent = new Intent(SimpleHeaderDrawerActivity.this, CustomContainerActivity.class);
            //        } else if (drawerItem.getIdentifier() == 20) {
            //          intent = new LibsBuilder()
            //            .WithFields(R.string.class.getFields())
            //            .WithActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
            //            .intent(SimpleHeaderDrawerActivity.this);
            //        }
            //        if (intent != null) {
            //          SimpleHeaderDrawerActivity.this.startActivity(intent);
            //        }
              }

              return false;
        }
Esempio n. 9
0
        public bool OnItemClick(View view, int position, IDrawerItem drawerItem)
        {
            if (drawerItem != null)
            {
                Intent intent;
                switch (position)
                {
                case 1:
                    if (user.type.Equals("Passenger"))
                    {
                        intent = new Intent(this, typeof(TripPassListViewActivity));
                    }
                    else if (user.type.Equals("Driver"))
                    {
                        intent = new Intent(this, typeof(TripDriverListViewActivity));
                    }
                    else
                    {
                        intent = new Intent(this, typeof(MainActivity));
                    }
                    StartActivity(intent);
                    break;

                case 3:
                    GetSharedPreferences(GetString(Resource.String.PreferenceFileName), FileCreationMode.Private)
                    .Edit()
                    .Clear()
                    .Commit();
                    intent = new Intent(this, typeof(LoginActivity));
                    StartActivity(intent);
                    Finish();
                    break;
                }
            }
            return(false);
        }
 public bool OnItemClick(View p0, int p1, IDrawerItem p2)
 {
     _action.Invoke(p0,p1,p2);
     return true;
 }
Esempio n. 11
0
 private void DescendingToggleOnCheckedChange(IDrawerItem arg1, bool arg2)
 {
     ViewModel.SortAscending = !arg2;
 }
 public void OnCheckedChanged(IDrawerItem p0, CompoundButton p1, bool p2)
 {
     _onChanged.Invoke(p0, p2);
 }
            public bool OnItemClick(AdapterView adapterView, View view, int position, long l, IDrawerItem drawerItem)
            {
                var font = Iconics.RegisteredFonts.ElementAt(position);

                this.activity.LoadIcons(font.FontName);
                this.activity.SupportActionBar.Title = font.FontName;

                return(false);
            }
            public bool OnItemClick(AdapterView adapterView, View view, int position, long l, IDrawerItem drawerItem)
            {
                var font = Iconics.RegisteredFonts.ElementAt(position);

                this.activity.LoadIcons(font.FontName);
                this.activity.SupportActionBar.Title = font.FontName;

                return false;
            }
Esempio n. 15
0
 private void OnHamburgerItemClick(View view, int i, IDrawerItem arg3)
 {
     //if (page == PageIndex.PageProfile)
        // ViewModelLocator.NavMgr.RegisterBackNav(PageIndex.PageAnimeList, null);
     var page = (PageIndex) arg3.Identifier;
     ViewModelLocator.GeneralMain.Navigate(page, GetAppropriateArgsForPage(page));
     _drawer.SetSelection(arg3, false);
     _drawer.CloseDrawer();
 }
Esempio n. 16
0
        //=====================================================================
        // MÉTODOS RELACIONADOS COM OS GOOGLE PLAY SERVICES
        //=====================================================================

        /*private bool ServicosGooglePlayEstaoDisponiveis()
         * {
         *  GoogleApiAvailability disponibilidadeApiGoogle = GoogleApiAvailability.Instance;
         *  int resQuery = disponibilidadeApiGoogle.IsGooglePlayServicesAvailable(this);
         *
         *  return (resQuery == ConnectionResult.Success);
         * }*/

        /*private Location ObterLocalizacao()
         * {
         *  Location loc;
         *
         *  if (clienteApiGoogle != null && clienteApiGoogle.IsConnected)
         *  {
         *      loc = LocationServices.FusedLocationApi.GetLastLocation(clienteApiGoogle);
         *  }
         *  else
         *      loc = null;
         *
         *  return loc;
         * }*/


        // -> REMOVER PRÓXIMOS 4 MÉTODOS COMENTADOS DEPOIS DO UtilitarioApiGoogle ESTAR TESTADO

        /*public async void OnConnected(Bundle connectionHint)
         * {
         *  Toast.MakeText(this, "A ligação aos serviços do Google Play foi bem sucedida.", ToastLength.Short);
         *
         *  pedidoLoc.SetPriority(LocationRequest.PriorityHighAccuracy);
         *  pedidoLoc.SetFastestInterval(FastestInterval);
         *  pedidoLoc.SetInterval(LocationUpdateInterval);
         *
         *  await LocationServices.FusedLocationApi.RequestLocationUpdates(clienteApiGoogle, pedidoLoc, this);
         * }
         *
         * public void OnLocationChanged(Location location)
         * {
         *
         * }
         *
         * public void OnConnectionSuspended(int cause)
         * {
         *  string msg;
         *
         *  switch (cause)
         *  {
         *      case GoogleApiClient.ConnectionCallbacks.CauseNetworkLost:
         *          msg = "A ligação ao serviço da Google Play foi abaixo por falta de rede.";
         *          break;
         *      case GoogleApiClient.ConnectionCallbacks.CauseServiceDisconnected:
         *          msg = "O serviço da Google Play foi terminado.";
         *          break;
         *      default:
         *          msg = "O serviço da Google Play foi suspenso por causa desconhecida.";
         *          break;
         *  }
         *  Toast.MakeText(this, msg, ToastLength.Short);
         * }
         *
         * public void OnConnectionFailed(ConnectionResult result)
         * {
         *  AlertDialog.Builder alerta = new AlertDialog.Builder(this);
         *
         *  alerta.SetTitle("Não foi possível ligar aos serviços do Google Play. Código do erro: " + result.ErrorCode);
         *  alerta.SetPositiveButton("OK", (sender, e) => { return; });
         *  alerta.Create().Show();
         * }*/

        //=====================================================================
        // RESPOSTA A EVENTOS DO DRAWER
        //=====================================================================

        public bool OnItemClick(View view, int position, IDrawerItem drawerItem)
        {
            // Existem várias razões para o "drawerItem" ser nulo:
            //   --> clique no cabeçalho;
            //   --> clique no rodapé;
            // Esses dois items não contêm um "drawerItem"
            if (drawerItem != null)
            {
                switch (drawerItem.Identifier)
                {
                case 1:     // Login
                    // Toast.MakeText(this, "Clique em Login", ToastLength.Short).Show();

                    StartActivity(typeof(LoginActivity));
                    break;

                case 2:     // Registo como cliente
                    if (drawerItem.Tag.Equals("RegCliente"))
                    {
                        // Toast.MakeText(this, "Clique em 'Registar Cliente'", ToastLength.Short).Show();
                        StartActivity(typeof(RegistoClienteActivity));
                    }

                    /* else
                     * {
                     *  Toast.MakeText(this, string.Format("Clique em 'Registar Proprietário'"), ToastLength.Short).Show();
                     * }*/
                    break;

                case 3:     // Preferências
                    // Toast.MakeText(this, "Clique em 'Preferências'", ToastLength.Short).Show();
                    StartActivity(typeof(PreferenciasActivity));
                    break;

                case 4:     // Não preferências
                    // Toast.MakeText(this, "Clique em 'Não Preferências'", ToastLength.Short).Show();
                    StartActivity(typeof(NaoPreferenciasActivity));
                    break;

                case 5:     // Terminar sessão
                    /* Sobre ActivityFlags: https://developer.xamarin.com/api/type/Android.Content.ActivityFlags/ */
                    Facade.TerminarSessao();
                    Toast.MakeText(this, "Sessão terminada com sucesso.", ToastLength.Short).Show();

                    var intent = new Intent(this, typeof(MainActivity));
                    intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
                    StartActivity(intent);
                    break;

                case 6:     // Sobre
                    Toast.MakeText(this, "Clique em 'Sobre'", ToastLength.Short).Show();
                    break;

                case 7:     // Definições
                    Toast.MakeText(this, "Clique em 'Definições'", ToastLength.Short).Show();
                    break;

                case 8:     // Tendencias
                    StartActivity(typeof(TendenciasActivity));
                    break;

                case 9:
                    StartActivity(typeof(HistoricoActivity));
                    break;
                }
                drawerItem.WithSetSelected(false);
            }
            return(false);
        }
        public bool OnItemClick(AdapterView parent, View view, int position, long id, IDrawerItem drawerItem)
        {
            //check if the drawerItem is set.
            //there are different reasons for the drawerItem to be null
            //--> click on the header
            //--> click on the footer
            //those items don't contain a drawerItem

            if (drawerItem != null)
            {
//        Intent intent = null;
//        if (drawerItem.Identifier == 1) {
//          intent = new Intent(SimpleHeaderDrawerActivity.this, SimpleCompactHeaderDrawerActivity.class);
//        } else if (drawerItem.getIdentifier() == 2) {
//          intent = new Intent(SimpleHeaderDrawerActivity.this, ActionBarDrawerActivity.class);
//        } else if (drawerItem.getIdentifier() == 3) {
//          intent = new Intent(SimpleHeaderDrawerActivity.this, MultiDrawerActivity.class);
//        } else if (drawerItem.getIdentifier() == 4) {
//          intent = new Intent(SimpleHeaderDrawerActivity.this, SimpleNonTranslucentDrawerActivity.class);
//        } else if (drawerItem.getIdentifier() == 5) {
//          intent = new Intent(SimpleHeaderDrawerActivity.this, ComplexHeaderDrawerActivity.class);
//        } else if (drawerItem.getIdentifier() == 6) {
//          intent = new Intent(SimpleHeaderDrawerActivity.this, SimpleFragmentDrawerActivity.class);
//        } else if (drawerItem.getIdentifier() == 7) {
//          intent = new Intent(SimpleHeaderDrawerActivity.this, EmbeddedDrawerActivity.class);
//        } else if (drawerItem.getIdentifier() == 8) {
//          intent = new Intent(SimpleHeaderDrawerActivity.this, FullscreenDrawerActivity.class);
//        } else if (drawerItem.getIdentifier() == 9) {
//          intent = new Intent(SimpleHeaderDrawerActivity.this, CustomContainerActivity.class);
//        } else if (drawerItem.getIdentifier() == 20) {
//          intent = new LibsBuilder()
//            .WithFields(R.string.class.getFields())
//            .WithActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
//            .intent(SimpleHeaderDrawerActivity.this);
//        }
//        if (intent != null) {
//          SimpleHeaderDrawerActivity.this.startActivity(intent);
//        }
            }

            return(false);
        }
Esempio n. 18
0
 public bool OnItemClick(View p0, int p1, IDrawerItem p2)
 {
     _action.Invoke(p0, p1, p2);
     return(true);
 }
Esempio n. 19
0
        private void OpenFiltersDrawer()
        {
            if (ViewModel.Loading)
            {
                return;
            }

            var         items      = new List <IDrawerItem>();
            IDrawerItem activeItem = null;

            foreach (var viewModelNotificationGroup in ViewModel.NotificationGroups)
            {
                var item = HamburgerUtilities.GetBaseSecondaryItem();
                item.WithName(viewModelNotificationGroup.NotificationType.GetDescription());
                item.WithBadge(viewModelNotificationGroup.NotificationsCount.ToString());
                item.WithIdentifier((int)viewModelNotificationGroup.NotificationType);

                if (ViewModel.CurrentNotificationType == viewModelNotificationGroup.NotificationType)
                {
                    activeItem = item;
                }



                items.Add(item);
            }

            var showAllItem = HamburgerUtilities.GetBaseSecondaryItem();

            showAllItem.WithName("All");
            showAllItem.WithIdentifier(3);

            items.Insert(0, showAllItem);

            if (activeItem == null)
            {
                activeItem = showAllItem;
            }



            _rightDrawer.SetItems(items);
            _rightDrawer.SetSelection(activeItem);


            _rightDrawer.StickyHeader.FindViewById <TextView>(Resource.Id.AnimeListPageDrawerHeaderText).Text = "Filters";
            _rightDrawer.StickyHeader.FindViewById <ImageView>(Resource.Id.AnimeListPageDrawerHeaderIcon).SetImageResource(
                Resource.Drawable.icon_filter);
            _rightDrawer.OnDrawerItemClickListener = new HamburgerItemClickListener((view, i, arg3) =>
            {
                if (arg3.Identifier != 3)
                {
                    ViewModel.CurrentNotificationType = (MalNotificationsTypes)arg3.Identifier;
                }
                else
                {
                    ViewModel.CurrentNotificationType = MalNotificationsTypes.Generic;
                }

                _rightDrawer.OnDrawerItemClickListener = null;
                _rightDrawer.CloseDrawer();
            });


            ViewModelLocator.NavMgr.RegisterOneTimeMainOverride(new RelayCommand(CloseDrawer));
            _rightDrawer.OpenDrawer();
        }
 private void DescendingToggleOnCheckedChange(IDrawerItem item, bool check)
 {
     ViewModel.SortDescending = check;
     ViewModel.RefreshList();
 }