コード例 #1
0
        private async void BuildDrawer()
        {
            var builder = new DrawerBuilder().WithActivity(this);
            builder.WithSliderBackgroundColorRes(Resource.Color.BrushHamburgerBackground);
            builder.WithStickyFooterShadow(true);


            var animeButton = GetBasePrimaryItem();
            animeButton.WithName("Anime list");
            animeButton.WithIdentifier((int)PageIndex.PageAnimeList);
            animeButton.WithIcon(Resource.Drawable.icon_list);

            var searchButton = GetBasePrimaryItem();
            searchButton.WithName("Anime search");
            searchButton.WithIdentifier((int)PageIndex.PageSearch);
            searchButton.WithIcon(Resource.Drawable.icon_search);

            var seasonalButton = GetBasePrimaryItem();
            seasonalButton.WithName("Seasonal anime");
            seasonalButton.WithIdentifier((int)PageIndex.PageSeasonal);
            seasonalButton.WithIcon(Resource.Drawable.icon_seasonal);

            var recomButton = GetBasePrimaryItem();
            recomButton.WithName("Recommendations");
            recomButton.WithIdentifier((int)PageIndex.PageRecomendations);
            recomButton.WithIcon(Resource.Drawable.icon_recom);

            var topAnimeButton = GetBasePrimaryItem();
            topAnimeButton.WithName("Top anime");
            topAnimeButton.WithIdentifier((int)PageIndex.PageTopAnime);
            topAnimeButton.WithIcon(Resource.Drawable.icon_fav_outline);

            var calendarButton = GetBasePrimaryItem();
            calendarButton.WithName("Calendar");
            calendarButton.WithIdentifier((int)PageIndex.PageCalendar);
            calendarButton.WithIcon(Resource.Drawable.icon_calendar);

            //

            var mangaListButton = GetBaseSecondaryItem();
            mangaListButton.WithName("Manga list");
            mangaListButton.WithIdentifier((int)PageIndex.PageMangaList);
            mangaListButton.WithIcon(Resource.Drawable.icon_books);

            var mangaSearchButton = GetBaseSecondaryItem();
            mangaSearchButton.WithName("Manga search");
            mangaSearchButton.WithIdentifier((int)PageIndex.PageMangaSearch);
            mangaSearchButton.WithIcon(Resource.Drawable.icon_search);

            var topMangaButton = GetBaseSecondaryItem();
            topMangaButton.WithName("Top manga");
            topMangaButton.WithIdentifier((int)PageIndex.PageTopManga);
            topMangaButton.WithIcon(Resource.Drawable.icon_fav_outline);

            //

            IDrawerItem accountButton;
            if (Credentials.Authenticated)
            {
                var btn = new ProfileDrawerItem();
                btn.WithName("Account");
                btn.WithTextColorRes(Resource.Color.BrushText);
                btn.WithSelectedColorRes(Resource.Color.BrushAnimeItemBackground);
                btn.WithSelectedTextColorRes(Resource.Color.AccentColour);
                btn.WithIdentifier((int)PageIndex.PageProfile);
                btn.WithIcon(Resource.Drawable.icon_account);
                accountButton = btn;
            }
            else
            {
                var btn = GetBaseSecondaryItem();
                btn.WithName("Sign in");
                btn.WithIdentifier((int)PageIndex.PageLogIn);
                btn.WithIcon(Resource.Drawable.icon_login);
                accountButton = btn;
            }

            var settingsButton = GetBaseSecondaryItem();
            settingsButton.WithName("Settings & more");
            settingsButton.WithIdentifier((int)PageIndex.PageSettings);
            settingsButton.WithIcon(Resource.Drawable.icon_settings);



            builder.AddStickyDrawerItems(accountButton, settingsButton);


            //

            var mangaSubHeader = new SectionDrawerItem();
            mangaSubHeader.WithName("Manga");
            mangaSubHeader.WithDivider(true);
            mangaSubHeader.WithTextColorRes(Resource.Color.BrushText);

            builder.WithDrawerItems(new List<IDrawerItem>()
            {
                animeButton,
                searchButton,
                seasonalButton,
                recomButton,
                topAnimeButton,
                calendarButton,
                mangaSubHeader,//
                mangaListButton,
                mangaSearchButton,
                topMangaButton,
            });

            _drawer = builder.Build();
            _drawer.StickyFooter.SetBackgroundColor(new Color(ResourceExtension.BrushAnimeItemInnerBackground));

            if (Credentials.Authenticated)
            {
                var bmp = await ImageService.Instance.LoadUrl(
                        $"https://myanimelist.cdn-dena.com/images/userimages/4952914.jpg")
                    .AsBitmapDrawableAsync();
                var btn = accountButton as ProfileDrawerItem;
                btn.WithIcon(bmp);
                _drawer.UpdateStickyFooterItem(btn);
            }
        }
コード例 #2
0
        private void BuildDrawer()
        {
            var builder = new DrawerBuilder().WithActivity(this);

            builder.WithSliderBackgroundColorRes(ResourceExtension.BrushHamburgerBackgroundRes);
            builder.WithStickyFooterShadow(true);
            builder.WithDisplayBelowStatusBar(true);


            var animeButton = GetBasePrimaryItem(OnAnimeListMore);

            animeButton.WithName("Anime list");
            animeButton.WithIdentifier((int)PageIndex.PageAnimeList);
            animeButton.WithIcon(Resource.Drawable.icon_list);

            var searchButton = GetBasePrimaryItem();

            searchButton.WithName("Search");
            searchButton.WithIdentifier((int)PageIndex.PageSearch);
            searchButton.WithIcon(Resource.Drawable.icon_search);

            var seasonalButton = GetBasePrimaryItem();

            seasonalButton.WithName("Seasonal anime");
            seasonalButton.WithIdentifier((int)PageIndex.PageSeasonal);
            seasonalButton.WithIcon(Resource.Drawable.icon_seasonal);

            var recomButton = GetBasePrimaryItem();

            recomButton.WithName("Recommendations");
            recomButton.WithIdentifier((int)PageIndex.PageRecomendations);
            recomButton.WithIcon(Resource.Drawable.icon_recom);

            var topAnimeButton = GetBasePrimaryItem(OnTopAnimeMore);

            topAnimeButton.WithName("Top anime");
            topAnimeButton.WithIdentifier((int)PageIndex.PageTopAnime);
            topAnimeButton.WithIcon(Resource.Drawable.icon_fav_outline);

            var calendarButton = GetBasePrimaryItem();

            calendarButton.WithName("Calendar");
            calendarButton.WithIdentifier((int)PageIndex.PageCalendar);
            calendarButton.WithIcon(Resource.Drawable.icon_calendar);

            //



            var articlesButton = GetBaseSecondaryItem();

            articlesButton.WithName("Articles & News");
            articlesButton.WithIdentifier((int)PageIndex.PageArticles);
            articlesButton.WithIcon(Resource.Drawable.icon_newspaper);

            var videoButton = GetBaseSecondaryItem();

            videoButton.WithName("Promotional Videos");
            videoButton.WithIdentifier((int)PageIndex.PagePopularVideos);
            videoButton.WithIcon(Resource.Drawable.icon_video);

            var feedsButton = GetBaseSecondaryItem();

            feedsButton.WithName("Friends Feeds");
            feedsButton.WithIdentifier((int)PageIndex.PageFeeds);
            feedsButton.WithIcon(Resource.Drawable.icon_feeds);

            var forumsButton = GetBaseSecondaryItem();

            forumsButton.WithName("Forums");
            forumsButton.WithIdentifier((int)PageIndex.PageForumIndex);
            forumsButton.WithIcon(Resource.Drawable.icon_forum);

            //var messagingButton = GetBaseSecondaryItem();
            //messagingButton.WithName("Messaging");
            //messagingButton.WithIdentifier((int) PageIndex.PageMessanging);
            //messagingButton.WithIcon(Resource.Drawable.icon_message_alt);

            var historyButton = GetBaseSecondaryItem();

            historyButton.WithName("History");
            historyButton.WithIdentifier((int)PageIndex.PageHistory);
            historyButton.WithIcon(Resource.Drawable.icon_clock);

            //var notificationHubButton = GetBaseSecondaryItem();
            //notificationHubButton.WithName("Notification Hub");
            //notificationHubButton.WithIdentifier((int) PageIndex.PageNotificationHub);
            //notificationHubButton.WithIcon(Resource.Drawable.icon_notification);

            var wallpapersButton = GetBaseSecondaryItem();

            wallpapersButton.WithName("Images");
            wallpapersButton.WithIdentifier((int)PageIndex.PageWallpapers);
            wallpapersButton.WithIcon(Resource.Drawable.icon_image_alt);

            var clubsButton = GetBaseSecondaryItem();

            clubsButton.WithName("Clubs");
            clubsButton.WithIdentifier((int)PageIndex.PageClubIndex);
            clubsButton.WithIcon(Resource.Drawable.icon_club);

            //
            var othersSubHeader = new SectionDrawerItem();

            othersSubHeader.WithName("Other");
            othersSubHeader.WithDivider(true);
            othersSubHeader.WithTextColorRes(ResourceExtension.BrushTextRes);

            if (!Settings.HamburgerHideMangaSection)
            {
                var mangaSubHeader = new SectionDrawerItem();
                mangaSubHeader.WithName("Manga");
                mangaSubHeader.WithDivider(true);
                mangaSubHeader.WithIdentifier(55779988);
                mangaSubHeader.WithTextColorRes(ResourceExtension.BrushTextRes);

                var mangaListButton = GetBaseSecondaryItem(OnMangaMore);
                mangaListButton.WithName("Manga list");
                mangaListButton.WithIdentifier((int)PageIndex.PageMangaList);
                mangaListButton.WithIcon(Resource.Drawable.icon_list);

                var topMangaButton = GetBaseSecondaryItem();
                topMangaButton.WithName("Top manga");
                topMangaButton.WithIdentifier((int)PageIndex.PageTopManga);
                topMangaButton.WithIcon(Resource.Drawable.icon_fav_outline);

                builder.WithDrawerItems(new List <IDrawerItem>()
                {
                    animeButton,
                    seasonalButton,
                    topAnimeButton,
                    searchButton,
                    recomButton,
                    calendarButton,
                    mangaSubHeader,//
                    mangaListButton,
                    topMangaButton,
                    othersSubHeader,//
                    articlesButton,
                    videoButton,
                    feedsButton,
                    forumsButton,
                    // messagingButton,
                    historyButton,
                    clubsButton,
                    // notificationHubButton,
                    wallpapersButton
                });
            }
            else
            {
                builder.WithDrawerItems(new List <IDrawerItem>()
                {
                    animeButton,
                    seasonalButton,
                    topAnimeButton,
                    searchButton,
                    recomButton,
                    calendarButton,
                    othersSubHeader,//
                    articlesButton,
                    videoButton,
                    feedsButton,
                    forumsButton,
                    // messagingButton,
                    historyButton,
                    // notificationHubButton,
                    wallpapersButton
                });
            }

            _drawer = builder.Build();
            UpdateLogInLabel();
            _drawer.StickyFooter.SetBackgroundColor(new Color(Settings.SelectedTheme == 1
                ? ResourceExtension.BrushAnimeItemInnerBackground
                : ResourceExtension.BrushAnimeItemBackground));

            _drawer.DrawerLayout.AddDrawerListener(new DrawerListener(OnClose, OnOpen));
        }
コード例 #3
0
        private async void BuildDrawer()
        {
            var builder = new DrawerBuilder().WithActivity(this);

            builder.WithSliderBackgroundColorRes(ResourceExtension.BrushHamburgerBackgroundRes);
            builder.WithStickyFooterShadow(true);
            builder.WithDisplayBelowStatusBar(true);


            var animeButton = GetBasePrimaryItem();

            animeButton.WithName("Anime list");
            animeButton.WithIdentifier((int)PageIndex.PageAnimeList);
            animeButton.WithIcon(Resource.Drawable.icon_list);

            var searchButton = GetBasePrimaryItem();

            searchButton.WithName("Anime search");
            searchButton.WithIdentifier((int)PageIndex.PageSearch);
            searchButton.WithIcon(Resource.Drawable.icon_search);

            var seasonalButton = GetBasePrimaryItem();

            seasonalButton.WithName("Seasonal anime");
            seasonalButton.WithIdentifier((int)PageIndex.PageSeasonal);
            seasonalButton.WithIcon(Resource.Drawable.icon_seasonal);

            var recomButton = GetBasePrimaryItem();

            recomButton.WithName("Recommendations");
            recomButton.WithIdentifier((int)PageIndex.PageRecomendations);
            recomButton.WithIcon(Resource.Drawable.icon_recom);

            var topAnimeButton = GetBasePrimaryItem();

            topAnimeButton.WithName("Top anime");
            topAnimeButton.WithIdentifier((int)PageIndex.PageTopAnime);
            topAnimeButton.WithIcon(Resource.Drawable.icon_fav_outline);

            var calendarButton = GetBasePrimaryItem();

            calendarButton.WithName("Calendar");
            calendarButton.WithIdentifier((int)PageIndex.PageCalendar);
            calendarButton.WithIcon(Resource.Drawable.icon_calendar);

            //

            var mangaListButton = GetBaseSecondaryItem();

            mangaListButton.WithName("Manga list");
            mangaListButton.WithIdentifier((int)PageIndex.PageMangaList);
            mangaListButton.WithIcon(Resource.Drawable.icon_books);

            var topMangaButton = GetBaseSecondaryItem();

            topMangaButton.WithName("Top manga");
            topMangaButton.WithIdentifier((int)PageIndex.PageTopManga);
            topMangaButton.WithIcon(Resource.Drawable.icon_fav_outline);

            var articlesButton = GetBaseSecondaryItem();

            articlesButton.WithName("Articles & News");
            articlesButton.WithIdentifier((int)PageIndex.PageArticles);
            articlesButton.WithIcon(Resource.Drawable.icon_newspaper);

            var videoButton = GetBaseSecondaryItem();

            videoButton.WithName("Promotional Videos");
            videoButton.WithIdentifier((int)PageIndex.PagePopularVideos);
            videoButton.WithIcon(Resource.Drawable.icon_video);

            var feedsButton = GetBaseSecondaryItem();

            feedsButton.WithName("Friends Feeds");
            feedsButton.WithIdentifier((int)PageIndex.PageFeeds);
            feedsButton.WithIcon(Resource.Drawable.icon_feeds);

            var forumsButton = GetBaseSecondaryItem();

            forumsButton.WithName("Friends Feeds");
            forumsButton.WithIdentifier((int)PageIndex.PageForumIndex);
            forumsButton.WithIcon(Resource.Drawable.icon_feeds);

            //

            IDrawerItem accountButton;

            if (Credentials.Authenticated)
            {
                var btn = new ProfileDrawerItem();
                btn.WithName("Account");
                btn.WithTextColorRes(ResourceExtension.BrushTextRes);
                btn.WithSelectedColorRes(ResourceExtension.BrushAnimeItemBackgroundRes);
                btn.WithSelectedTextColorRes(Resource.Color.AccentColour);
                btn.WithIdentifier((int)PageIndex.PageProfile);
                btn.WithIcon(Resource.Drawable.icon_account);
                accountButton = btn;
            }
            else
            {
                var btn = GetBaseSecondaryItem();
                btn.WithName("Sign in");
                btn.WithIdentifier((int)PageIndex.PageLogIn);
                btn.WithIcon(Resource.Drawable.icon_login);
                accountButton = btn;
            }

            var settingsButton = GetBaseSecondaryItem();

            settingsButton.WithName("Settings & more");
            settingsButton.WithIdentifier((int)PageIndex.PageSettings);
            settingsButton.WithIcon(Resource.Drawable.icon_settings);



            builder.AddStickyDrawerItems(accountButton, settingsButton);
            //
            var mangaSubHeader = new SectionDrawerItem();

            mangaSubHeader.WithName("Manga");
            mangaSubHeader.WithDivider(true);
            mangaSubHeader.WithTextColorRes(ResourceExtension.BrushTextRes);


            var othersSubHeader = new SectionDrawerItem();

            othersSubHeader.WithName("Other");
            othersSubHeader.WithDivider(true);
            othersSubHeader.WithTextColorRes(ResourceExtension.BrushTextRes);


            builder.WithDrawerItems(new List <IDrawerItem>()
            {
                animeButton,
                searchButton,
                seasonalButton,
                recomButton,
                topAnimeButton,
                calendarButton,
                mangaSubHeader,//
                mangaListButton,
                topMangaButton,
                othersSubHeader,//
                articlesButton,
                videoButton,
                feedsButton,
                forumsButton
            });

            _drawer = builder.Build();
            _drawer.StickyFooter.SetBackgroundColor(new Color(ResourceExtension.BrushAnimeItemInnerBackground));

            if (Credentials.Authenticated)
            {
                var bmp = await ImageService.Instance.LoadUrl(
                    $"https://myanimelist.cdn-dena.com/images/userimages/{Credentials.Id}.jpg")
                          .AsBitmapDrawableAsync();

                var btn = accountButton as ProfileDrawerItem;
                btn.WithIcon(bmp);
                _drawer.UpdateStickyFooterItem(btn);
            }
        }