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
        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);
        }