private void OpenFiltersDrawer()
        {
            var items = new List <IDrawerItem>();

            _startingSet = new HashSet <WallpaperSources>(Settings.EnabledWallpaperSources);
            _workingSet  = new HashSet <WallpaperSources>(Settings.EnabledWallpaperSources);
            var listener = new DrawerCheckedChangeListener((drawerItem, b) =>
            {
                if (b)
                {
                    _workingSet.Add((WallpaperSources)drawerItem.Identifier);
                }
                else
                {
                    _workingSet.Remove((WallpaperSources)drawerItem.Identifier);
                }
            });

            foreach (WallpaperSources source in Enum.GetValues(typeof(WallpaperSources)))
            {
                var item = new SwitchDrawerItem();
                item.WithTextColorRes(ResourceExtension.BrushTextRes);
                item.WithChecked(_startingSet.Contains(source));
                item.WithName($"/r/{source}");
                item.WithIdentifier((int)source);
                item.WithOnCheckedChangeListener(listener);

                items.Add(item);
            }

            _rightDrawer.SetItems(items);

            _rightDrawer.StickyHeader.FindViewById <TextView>(Resource.Id.AnimeListPageDrawerHeaderText).Text = "Sources";
            _rightDrawer.StickyHeader.FindViewById <ImageView>(Resource.Id.AnimeListPageDrawerHeaderIcon).SetImageResource(
                Resource.Drawable.icon_double_check);


            ViewModelLocator.NavMgr.RegisterOneTimeMainOverride(new RelayCommand(() => _rightDrawer.CloseDrawer()));

            _rightDrawer.OpenDrawer();
        }
Пример #2
0
        private void OpenSortingDrawer()
        {
            var items = new List <IDrawerItem>();

            _rightDrawer.OnDrawerItemClickListener = null;
            foreach (var enumValue in Enum.GetValues(typeof(ComparisonSorting)).Cast <ComparisonSorting>())
            {
                var btn = HamburgerUtilities.GetBaseSecondaryItem();
                btn.WithName(enumValue.GetDescription());
                btn.WithIdentifier((int)enumValue);
                items.Add(btn);
            }

            var descendingToggle = new SwitchDrawerItem();

            descendingToggle.WithName("Descending Order");
            descendingToggle.WithChecked(!ViewModel.SortAscending);
            descendingToggle.WithOnCheckedChangeListener(
                new DrawerCheckedChangeListener(DescendingToggleOnCheckedChange));
            descendingToggle.WithIdentifier(998877);
            descendingToggle.WithTextColorRes(ResourceExtension.BrushTextRes);
            items.Add(descendingToggle);

            _rightDrawer.SetItems(items);
            _rightDrawer.SetSelection((int)ViewModel.ComparisonSorting);

            _rightDrawer.StickyHeader.FindViewById <TextView>(Resource.Id.AnimeListPageDrawerHeaderText).Text = "Sorting";
            _rightDrawer.StickyHeader.FindViewById <ImageView>(Resource.Id.AnimeListPageDrawerHeaderIcon).SetImageResource(
                Resource.Drawable.icon_sort);
            _rightDrawer.OnDrawerItemClickListener = new HamburgerItemClickListener((view, i, arg3) =>
            {
                ViewModel.ComparisonSorting = (ComparisonSorting)arg3.Identifier;
                CloseDrawer();
            });

            ViewModelLocator.NavMgr.RegisterOneTimeMainOverride(new RelayCommand(CloseDrawer));
            _rightDrawer.OpenDrawer();
            _actionMenu.Close(true);
        }
Пример #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

              // Set our view from the "main" layout resource
              SetContentView(Resource.Layout.activity_sample_dark_toolbar);

              var toolbar = this.FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
              this.SetSupportActionBar(toolbar);

              // Create a few sample profile
              // NOTE you have to define the loader logic too. See the CustomApplication for more details

              var profile = new ProfileDrawerItem().WithName("Mike Penz").WithEmail("*****@*****.**").WithIcon("https://avatars3.githubusercontent.com/u/1476232?v=3&s=460");
              var profile2 = new ProfileDrawerItem().WithName("Bernat Borras").WithEmail("*****@*****.**").WithIcon(Uri.Parse("https://avatars3.githubusercontent.com/u/887462?v=3&s=460"));
              var profile3 = new ProfileDrawerItem().WithName("Max Muster").WithEmail("*****@*****.**").WithIcon(Resources.GetDrawable(Resource.Drawable.profile2));
              var profile4 = new ProfileDrawerItem().WithName("Felix House").WithEmail("*****@*****.**").WithIcon(Resources.GetDrawable(Resource.Drawable.profile3));
              var profile5 = new ProfileDrawerItem().WithName("Mr. X").WithEmail("*****@*****.**").WithIcon(Resources.GetDrawable(Resource.Drawable.profile4)).WithIdentifier(4);
              var profile6 = new ProfileDrawerItem().WithName("Batman").WithEmail("*****@*****.**").WithIcon(Resources.GetDrawable(Resource.Drawable.profile5));

              headerResult = new AccountHeaderBuilder()
            .WithActivity(this)
            .WithHeaderBackground(Resource.Drawable.header)
            .AddProfiles(
              profile,
              profile2,
              profile3,
              profile4,
              profile5,
              profile6,
              //don't ask but google uses 14dp for the add account icon in gmail but 20dp for the normal icons (like manage account)
              new ProfileSettingDrawerItem().WithName("Add Account").WithDescription("Add new GitHub Account").WithIcon(new IconicsDrawable(this, GoogleMaterial.Icon.GmdAdd)
            .PaddingDp(5).ColorRes(Resource.Color.material_drawer_primary_text)).WithIdentifier(PROFILE_SETTING),
              new ProfileSettingDrawerItem().WithName("Manage Account").WithIcon(GoogleMaterial.Icon.GmdSettings)
            )
            .WithOnAccountHeaderListener(this)
            .WithSavedInstance(savedInstanceState)
            .Build();

              var item1 = new PrimaryDrawerItem();
              item1.WithName(Resource.String.drawer_item_compact_header);
              item1.WithIcon(GoogleMaterial.Icon.GmdWbSunny);
              item1.WithIdentifier(1);
              item1.WithCheckable(false);

              var item2 = new PrimaryDrawerItem();
              item2.WithName(Resource.String.drawer_item_action_bar);
              item2.WithIcon(FontAwesome.Icon.FawHome);
              item2.WithIdentifier(2);
              item2.WithCheckable(false);

              var item3 = new PrimaryDrawerItem();
              item3.WithName(Resource.String.drawer_item_multi_drawer);
              item3.WithIcon(FontAwesome.Icon.FawGamepad);
              item3.WithIdentifier(3);
              item3.WithCheckable(false);

              var item4 = new PrimaryDrawerItem();
              item4.WithName(Resource.String.drawer_item_non_translucent_status_drawer);
              item4.WithIcon(FontAwesome.Icon.FawEye);
              item4.WithIdentifier(4);
              item4.WithCheckable(false);

              var item5 = new PrimaryDrawerItem();
              item5.WithDescription("A more complex sample");
              item5.WithName(Resource.String.drawer_item_complex_header_drawer);
              item5.WithIcon(GoogleMaterial.Icon.GmdAdb);
              item5.WithIdentifier(5);
              item5.WithCheckable(false);

              var item6 = new PrimaryDrawerItem();
              item6.WithName(Resource.String.drawer_item_simple_fragment_drawer);
              item6.WithIcon(GoogleMaterial.Icon.GmdStyle);
              item6.WithIdentifier(6);
              item6.WithCheckable(false);

              var item7 = new PrimaryDrawerItem();
              item7.WithName(Resource.String.drawer_item_embedded_drawer_dualpane);
              item7.WithIcon(GoogleMaterial.Icon.GmdBatteryChargingFull);
              item7.WithIdentifier(7);
              item7.WithCheckable(false);

              var item8 = new PrimaryDrawerItem();
              item8.WithName(Resource.String.drawer_item_fullscreen_drawer);
              item8.WithIcon(GoogleMaterial.Icon.GmdStyle);
              item8.WithIdentifier(8);
              item8.WithCheckable(false);

              var item9 = new PrimaryDrawerItem();
              item9.WithName(Resource.String.drawer_item_custom_container_drawer);
              item9.WithIcon(GoogleMaterial.Icon.GmdMyLocation);
              item9.WithIdentifier(9);
              item9.WithCheckable(false);

              var item10 = new SecondaryDrawerItem();
              item10.WithName(Resource.String.drawer_item_open_source);
              item10.WithIcon(FontAwesome.Icon.FawGithub);
              item10.WithIdentifier(20);
              item10.WithCheckable(false);

              var item11 = new SecondaryDrawerItem();
              item11.WithName(Resource.String.drawer_item_contact);
              item11.WithIcon(GoogleMaterial.Icon.GmdFormatColorFill);
              item11.WithIdentifier(10);
              item11.WithTag("Bullhorn");

              var item12 = new SwitchDrawerItem();
              item12.WithName("Switch");
              item12.WithIcon(Octicons.Icon.OctTools);
              item12.WithChecked(true);
              item12.WithOnCheckedChangeListener(this);

              var item13 = new SwitchDrawerItem();
              item13.WithName("Switch2");
              item13.WithIcon(Octicons.Icon.OctTools);
              item13.WithChecked(true);
              item13.WithOnCheckedChangeListener(this);

              var item14 = new ToggleDrawerItem();
              item14.WithName("Toggle");
              item14.WithIcon(Octicons.Icon.OctTools);
              item14.WithChecked(true);
              item14.WithOnCheckedChangeListener(this);

              result = new DrawerBuilder()
            .WithActivity(this)
            .WithToolbar(toolbar)
            .WithAccountHeader(headerResult) //set the AccountHeader we created earlier for the header
            .AddDrawerItems(
              item1,
              item2,
              item3,
              item4,
              item5,
              item6,
              item7,
              item8,
              item9,
              new SectionDrawerItem().WithName(Resource.String.drawer_item_section_header),
              item10,
              item11,
              new DividerDrawerItem(),
              item12,
              item13,
              item14
            ) // add the items we want to use With our Drawer
            .WithOnDrawerItemClickListener(this)
            .WithSavedInstance(savedInstanceState)
            .WithShowDrawerOnFirstLaunch(true)
            .Build();

              if (savedInstanceState == null) {
            // set the selection to the item with the identifier 10
            result.SetSelectionByIdentifier(10, false);

            //set the active profile
            headerResult.SetActiveProfile(profile3);
              }
        }
Пример #4
0
        private void OpenSortingDrawer()
        {
            var items   = new List <IDrawerItem>();
            var options = Enum.GetValues(typeof(SortOptions)).Cast <SortOptions>();

            if (ViewModel.IsMangaWorkMode)
            {
                options = options.Except(new[] { SortOptions.SortAirDay, SortOptions.SortSeason });
            }
            foreach (SortOptions sortOption in options)
            {
                var btn = HamburgerUtilities.GetBaseSecondaryItem();
                if (sortOption == SortOptions.SortWatched)
                {
                    btn.WithName(ViewModel.Sort3Label);
                }
                else
                {
                    btn.WithName(sortOption.GetDescription());
                }
                btn.WithIdentifier((int)sortOption);
                items.Add(btn);
            }

            var descendingToggle = new SwitchDrawerItem();

            descendingToggle.WithName("Descending Order");
            descendingToggle.WithChecked(ViewModel.SortDescending);
            descendingToggle.WithOnCheckedChangeListener(
                new DrawerCheckedChangeListener(DescendingToggleOnCheckedChange));
            descendingToggle.WithIdentifier(998877);
            descendingToggle.WithTextColorRes(ResourceExtension.BrushTextRes);
            items.Add(descendingToggle);

            RightDrawer.SetItems(items);
            RightDrawer.SetSelection((int)ViewModel.SortOption);

            RightDrawer.StickyHeader.FindViewById <TextView>(Resource.Id.AnimeListPageDrawerHeaderText).Text = "Sorting";
            RightDrawer.StickyHeader.FindViewById <ImageView>(Resource.Id.AnimeListPageDrawerHeaderIcon).SetImageResource(
                Resource.Drawable.icon_sort);
            RightDrawer.OnDrawerItemClickListener = new HamburgerItemClickListener((view, i, arg3) =>
            {
                if (view == null)
                {
                    return;
                }
                if (arg3.Identifier == 998877)
                {
                    ViewModel.SortDescending = !ViewModel.SortDescending;
                    ViewModel.RefreshList();
                }
                else
                {
                    ViewModel.SetSortOrder((SortOptions)arg3.Identifier);
                    ViewModel.RefreshList();
                }

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

            ViewModelLocator.NavMgr.RegisterOneTimeMainOverride(new RelayCommand(CloseDrawer));
            RightDrawer.OpenDrawer();
            _actionMenu.Close(true);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_sample_dark_toolbar);

            var toolbar = this.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            this.SetSupportActionBar(toolbar);

            // Create a few sample profile
            // NOTE you have to define the loader logic too. See the CustomApplication for more details

            var profile  = new ProfileDrawerItem().WithName("Mike Penz").WithEmail("*****@*****.**").WithIcon("https://avatars3.githubusercontent.com/u/1476232?v=3&s=460");
            var profile2 = new ProfileDrawerItem().WithName("Bernat Borras").WithEmail("*****@*****.**").WithIcon(Uri.Parse("https://avatars3.githubusercontent.com/u/887462?v=3&s=460"));
            var profile3 = new ProfileDrawerItem().WithName("Max Muster").WithEmail("*****@*****.**").WithIcon(Resources.GetDrawable(Resource.Drawable.profile2));
            var profile4 = new ProfileDrawerItem().WithName("Felix House").WithEmail("*****@*****.**").WithIcon(Resources.GetDrawable(Resource.Drawable.profile3));
            var profile5 = new ProfileDrawerItem().WithName("Mr. X").WithEmail("*****@*****.**").WithIcon(Resources.GetDrawable(Resource.Drawable.profile4)).WithIdentifier(4);
            var profile6 = new ProfileDrawerItem().WithName("Batman").WithEmail("*****@*****.**").WithIcon(Resources.GetDrawable(Resource.Drawable.profile5));

            headerResult = new AccountHeaderBuilder()
                           .WithActivity(this)
                           .WithHeaderBackground(Resource.Drawable.header)
                           .AddProfiles(
                profile,
                profile2,
                profile3,
                profile4,
                profile5,
                profile6,
                //don't ask but google uses 14dp for the add account icon in gmail but 20dp for the normal icons (like manage account)
                new ProfileSettingDrawerItem().WithName("Add Account").WithDescription("Add new GitHub Account").WithIcon(new IconicsDrawable(this, GoogleMaterial.Icon.GmdAdd)
                                                                                                                          .PaddingDp(5).ColorRes(Resource.Color.material_drawer_primary_text)).WithIdentifier(PROFILE_SETTING),
                new ProfileSettingDrawerItem().WithName("Manage Account").WithIcon(GoogleMaterial.Icon.GmdSettings)
                )
                           .WithOnAccountHeaderListener(this)
                           .WithSavedInstance(savedInstanceState)
                           .Build();


            var item1 = new PrimaryDrawerItem();

            item1.WithName(Resource.String.drawer_item_compact_header);
            item1.WithIcon(GoogleMaterial.Icon.GmdWbSunny);
            item1.WithIdentifier(1);
            item1.WithCheckable(false);

            var item2 = new PrimaryDrawerItem();

            item2.WithName(Resource.String.drawer_item_action_bar);
            item2.WithIcon(FontAwesome.Icon.FawHome);
            item2.WithIdentifier(2);
            item2.WithCheckable(false);

            var item3 = new PrimaryDrawerItem();

            item3.WithName(Resource.String.drawer_item_multi_drawer);
            item3.WithIcon(FontAwesome.Icon.FawGamepad);
            item3.WithIdentifier(3);
            item3.WithCheckable(false);

            var item4 = new PrimaryDrawerItem();

            item4.WithName(Resource.String.drawer_item_non_translucent_status_drawer);
            item4.WithIcon(FontAwesome.Icon.FawEye);
            item4.WithIdentifier(4);
            item4.WithCheckable(false);

            var item5 = new PrimaryDrawerItem();

            item5.WithDescription("A more complex sample");
            item5.WithName(Resource.String.drawer_item_complex_header_drawer);
            item5.WithIcon(GoogleMaterial.Icon.GmdAdb);
            item5.WithIdentifier(5);
            item5.WithCheckable(false);

            var item6 = new PrimaryDrawerItem();

            item6.WithName(Resource.String.drawer_item_simple_fragment_drawer);
            item6.WithIcon(GoogleMaterial.Icon.GmdStyle);
            item6.WithIdentifier(6);
            item6.WithCheckable(false);

            var item7 = new PrimaryDrawerItem();

            item7.WithName(Resource.String.drawer_item_embedded_drawer_dualpane);
            item7.WithIcon(GoogleMaterial.Icon.GmdBatteryChargingFull);
            item7.WithIdentifier(7);
            item7.WithCheckable(false);

            var item8 = new PrimaryDrawerItem();

            item8.WithName(Resource.String.drawer_item_fullscreen_drawer);
            item8.WithIcon(GoogleMaterial.Icon.GmdStyle);
            item8.WithIdentifier(8);
            item8.WithCheckable(false);

            var item9 = new PrimaryDrawerItem();

            item9.WithName(Resource.String.drawer_item_custom_container_drawer);
            item9.WithIcon(GoogleMaterial.Icon.GmdMyLocation);
            item9.WithIdentifier(9);
            item9.WithCheckable(false);


            var item10 = new SecondaryDrawerItem();

            item10.WithName(Resource.String.drawer_item_open_source);
            item10.WithIcon(FontAwesome.Icon.FawGithub);
            item10.WithIdentifier(20);
            item10.WithCheckable(false);

            var item11 = new SecondaryDrawerItem();

            item11.WithName(Resource.String.drawer_item_contact);
            item11.WithIcon(GoogleMaterial.Icon.GmdFormatColorFill);
            item11.WithIdentifier(10);
            item11.WithTag("Bullhorn");

            var item12 = new SwitchDrawerItem();

            item12.WithName("Switch");
            item12.WithIcon(Octicons.Icon.OctTools);
            item12.WithChecked(true);
            item12.WithOnCheckedChangeListener(this);

            var item13 = new SwitchDrawerItem();

            item13.WithName("Switch2");
            item13.WithIcon(Octicons.Icon.OctTools);
            item13.WithChecked(true);
            item13.WithOnCheckedChangeListener(this);

            var item14 = new ToggleDrawerItem();

            item14.WithName("Toggle");
            item14.WithIcon(Octicons.Icon.OctTools);
            item14.WithChecked(true);
            item14.WithOnCheckedChangeListener(this);

            result = new DrawerBuilder()
                     .WithActivity(this)
                     .WithToolbar(toolbar)
                     .WithAccountHeader(headerResult) //set the AccountHeader we created earlier for the header
                     .AddDrawerItems(
                item1,
                item2,
                item3,
                item4,
                item5,
                item6,
                item7,
                item8,
                item9,
                new SectionDrawerItem().WithName(Resource.String.drawer_item_section_header),
                item10,
                item11,
                new DividerDrawerItem(),
                item12,
                item13,
                item14
                ) // add the items we want to use With our Drawer
                     .WithOnDrawerItemClickListener(this)
                     .WithSavedInstance(savedInstanceState)
                     .WithShowDrawerOnFirstLaunch(true)
                     .Build();

            if (savedInstanceState == null)
            {
                // set the selection to the item with the identifier 10
                result.SetSelectionByIdentifier(10, false);

                //set the active profile
                headerResult.SetActiveProfile(profile3);
            }
        }