コード例 #1
0
        public static DroppyMenuPopup BuildForRecommendationsPage(Context context, View parent, RecommendationsViewModel viewModel, Action <int> callback)
        {
            AnimeListPageFlyoutBuilder.ParamRelativeLayout = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(200), DimensionsHelper.DpToPx(38));

            var droppyBuilder = new DroppyMenuPopup.Builder(context, parent);

            AnimeListPageFlyoutBuilder.InjectAnimation(droppyBuilder);

            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Anime recommendations", callback, 0)));
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Manga recommendations", callback, 1)));


            return(droppyBuilder.Build());
        }
コード例 #2
0
        public static DroppyMenuPopup BuildForAnimeDetailsPage(Context context, View parent, AnimeDetailsPageViewModel viewModel)
        {
            AnimeListPageFlyoutBuilder.ParamRelativeLayout = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(150), DimensionsHelper.DpToPx(38));

            var droppyBuilder = new DroppyMenuPopup.Builder(context, parent);

            AnimeListPageFlyoutBuilder.InjectAnimation(droppyBuilder);

            Action <int> listener = i =>
            {
                switch (i)
                {
                case 0:
                    viewModel.NavigateForumBoardCommand.Execute(null);
                    break;

                case 1:
                    AnimeDetailsPageDialogBuilder.BuildPromotionalVideoDialog(viewModel);
                    break;

                case 2:
                    AnimeUpdateDialogBuilder.BuildTagDialog(viewModel);
                    break;

                case 3:
                    viewModel.CopyToClipboardCommand.Execute(null);
                    break;

                case 4:
                    viewModel.OpenInMalCommand.Execute(null);
                    break;

                case 5:
                    viewModel.RemoveAnimeCommand.Execute(null);
                    break;
                }
            };

            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Forum board", listener, 0)));
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Promotional videos", listener, 1)));
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Tags", listener, 2)));
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Copy link", listener, 3)));
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Open in browser", listener, 4)));
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Remove from my list", listener, 5)));


            return(droppyBuilder.Build());
        }
コード例 #3
0
        public static DroppyMenuPopup BuildForAnimeItemTags(Context context, View parent, AnimeItemViewModel viewModel, Action callback)
        {
            AnimeListPageFlyoutBuilder.ParamRelativeLayout = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(150), DimensionsHelper.DpToPx(38));

            var droppyBuilder = new DroppyMenuPopup.Builder(context, parent);

            AnimeListPageFlyoutBuilder.InjectAnimation(droppyBuilder);


            var listener = new Action <int>(i => callback.Invoke());

            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Tags:", listener, 0, ResourceExtension.BrushRowAlternate2, null, false, GravityFlags.CenterHorizontal)));
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(new DroppyMenuSeparatorView(context)));
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, viewModel.Notes, listener, 1, null, null, false, GravityFlags.CenterHorizontal)));

            return(droppyBuilder.Build());
        }
コード例 #4
0
        public static DroppyMenuPopup BuildForAnimeDetailsPage(Context context, AnimeDetailsPageViewModel viewModel, View parent, Action <int> listener)
        {
            AnimeListPageFlyoutBuilder.ParamRelativeLayout = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(150), DimensionsHelper.DpToPx(38));

            var droppyBuilder = new DroppyMenuPopup.Builder(context, parent);

            AnimeListPageFlyoutBuilder.InjectAnimation(droppyBuilder);



            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Forum board", listener, 0)));
            if (viewModel.AnimeMode)
            {
                droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Promotional videos", listener, 1)));
            }
            if (!viewModel.AddAnimeVisibility)
            {
                droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Tags", listener, 2)));
            }
            if (viewModel.IsRewatchingButtonVisibility)
            {
                droppyBuilder.AddMenuItem(
                    new DroppyMenuCustomItem(
                        AnimeListPageFlyoutBuilder.BuildItem(context, viewModel.RewatchingLabel, listener, 6, viewModel.IsRewatching ? (int?)ResourceExtension.AccentColour : null)));
            }
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Copy title", listener, 7)));
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Copy link", listener, 3)));
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Open in browser", listener, 4)));
            if (!viewModel.AddAnimeVisibility)
            {
                droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Remove from my list", listener, 5)));
            }
            if (viewModel.AiringNotificationsButtonVisibility)
            {
                droppyBuilder.AddMenuItem(
                    new DroppyMenuCustomItem(
                        AnimeListPageFlyoutBuilder.BuildItem(context, "Air Notifications", listener, 8,
                                                             viewModel.AreAirNotificationsEnabled ? (int?)ResourceExtension.AccentColour : null,
                                                             viewModel.AreAirNotificationsEnabled
                                ? (int?)ResourceExtension.White
                                : null)));
            }

            return(droppyBuilder.Build());
        }
コード例 #5
0
        public static DroppyMenuPopup BuildGenericFlyout(Context context, View parent, List <string> items, Action <int> callback, string header = null)
        {
            AnimeListPageFlyoutBuilder.ParamRelativeLayout = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(200), DimensionsHelper.DpToPx(38));

            var droppyBuilder = new DroppyMenuPopup.Builder(context, parent);

            AnimeListPageFlyoutBuilder.InjectAnimation(droppyBuilder);

            if (header != null)
            {
                droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, header, i => {}, 0, ResourceExtension.BrushRowAlternate2, null, false, GravityFlags.CenterHorizontal)));
                droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(new DroppyMenuSeparatorView(context)));
            }

            for (int i = 0; i < items.Count; i++)
            {
                droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, items[i], callback, i)));
            }

            return(droppyBuilder.Build());
        }
コード例 #6
0
        public static DroppyMenuPopup BuildForAnimeItem(Context context, View parent, AnimeItemViewModel viewModel, Action <AnimeGridItemMoreFlyoutButtons> callback, bool forceSmall = false)
        {
            AnimeListPageFlyoutBuilder.ParamRelativeLayout = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(150), DimensionsHelper.DpToPx(38));

            var droppyBuilder = new DroppyMenuPopup.Builder(context, parent);

            AnimeListPageFlyoutBuilder.InjectAnimation(droppyBuilder);


            var listener = new Action <int>(i => callback.Invoke((AnimeGridItemMoreFlyoutButtons)i));

            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Copy to clipboard", listener, 0)));
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Open in browser", listener, 1)));
            if (!forceSmall && viewModel.Auth)
            {
                droppyBuilder.AddSeparator();
                droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Set status", listener, 2)));
                droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Set score", listener, 3)));
                droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(context, "Set watched", listener, 4)));
            }
            return(droppyBuilder.Build());
        }
コード例 #7
0
        private DroppyMenuPopup BuildForPinnedPosts()
        {
            AnimeListPageFlyoutBuilder.ParamRelativeLayout = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(250), DimensionsHelper.DpToPx(38));

            var droppyBuilder = new DroppyMenuPopup.Builder(_parent.Context, _parent);

            AnimeListPageFlyoutBuilder.InjectAnimation(droppyBuilder);

            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(AnimeListPageFlyoutBuilder.BuildItem(_parent.Context, "Pinned posts", i => { }, 0, ResourceExtension.BrushRowAlternate2, null, false, GravityFlags.CenterHorizontal)));
            droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(new DroppyMenuSeparatorView(_parent.Context)));
            if (_viewModel.PinnedTopics.Any())
            {
                _list = new ListView(_parent.Context)
                {
                    LayoutParameters = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(250), -2), Id = 7890
                };
                _list.SetBackgroundColor(new Color(ResourceExtension.BrushAnimeItemInnerBackground));
                _list.Adapter = _viewModel.PinnedTopics.GetAdapter(GetTemplateDelegate);
                droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(_list));
            }
            else
            {
                var txt = new TextView(_parent.Context)
                {
                    LayoutParameters = new ViewGroup.LayoutParams(-1, -2),
                    Text             = "Hold topic to pin it.",
                    Gravity          = GravityFlags.CenterHorizontal
                };
                txt.SetTypeface(Typeface.Create(ResourceExtension.FontSizeLight, TypefaceStyle.Normal), TypefaceStyle.Normal);
                txt.SetTextColor(new Color(ResourceExtension.BrushNoSearchResults));
                var padding = DimensionsHelper.DpToPx(10);
                txt.SetPadding(0, padding, 0, padding);
                txt.SetBackgroundColor(new Color(ResourceExtension.BrushAnimeItemInnerBackground));
                droppyBuilder.AddMenuItem(new DroppyMenuCustomItem(txt));
            }


            return(droppyBuilder.Build());
        }