Exemplo n.º 1
0
        private void OnProfileSubItemCLick(View view)
        {
            switch (view.Id)
            {
            case Resource.Id.HamburgerProfileItemNotifications:
                OnHamburgerItemClick(PageIndex.PageNotificationHub);
                break;

            case Resource.Id.HamburgerProfileItemMessages:
                OnHamburgerItemClick(PageIndex.PageMessanging);
                break;

            case Resource.Id.HamburgerProfileItemSupport:
                _supportMenu = FlyoutMenuBuilder.BuildGenericFlyout(this, view,
                                                                    new List <string> {
                    "Feedback", "Review", "Donate Google", "Donate PayPal", "Turn on ads"
                }, OnSupportMenuSelection);
                _supportMenu.Show();
                _supportMenu.OnHiddenWithoutSelection += (sender, args) =>
                {
                    ViewModelLocator.NavMgr.RegisterOneTimeOverride(new RelayCommand(() => _drawer.CloseDrawer()));
                };
                break;
            }
        }
Exemplo n.º 2
0
 private void MoreButtonOnClick()
 {
     _menu = AnimeItemFlyoutBuilder.BuildForAnimeItem(Context, AnimeGridItemMoreButton,
                                                      ViewModel,
                                                      MenuOnMenuItemClick);
     _menu.Show();
 }
 private void ShowFilterMenu()
 {
     _filterMenu = AnimeListPageFlyoutBuilder.BuildForAnimeStatusSelection(MainActivity.CurrentContext,
                                                                           AnimeListPageFilterMenu,
                                                                           OnFilterMenuSelectionChanged, (AnimeStatus)ViewModel.CurrentStatus, ViewModel.IsMangaWorkMode);
     _filterMenu.Show();
 }
 private void ShowSortMenu()
 {
     _sortingMenu = AnimeListPageFlyoutBuilder.BuildForAnimeSortingSelection(MainActivity.CurrentContext,
                                                                             AnimeListPageSortMenu,
                                                                             OnSortingMenuSelectionChanged, ViewModel.SortOption);
     _sortingMenu.Show();
 }
        private void ShowSeasonMenu()
        {
            _seasonMenu = AnimeListPageFlyoutBuilder.BuildForAnimeSeasonSelection(Activity, AnimeListPageSeasonMenu,
                                                                                  SelectSeason, ViewModel);
            _seasonMenu.Show();
            var spinnerYear   = _seasonMenu.MenuView.FindViewById <Spinner>(Resource.Id.SeasonSelectionPopupYearComboBox);
            var spinnerSeason = _seasonMenu.MenuView.FindViewById <Spinner>(Resource.Id.SeasonSelectionPopupSeasonComboBox);

            spinnerYear.Adapter = ViewModel.SeasonYears.GetAdapter((i, s, arg3) =>
            {
                var view = arg3 ?? BuildBaseItem(Activity, s, ResourceExtension.BrushAnimeItemInnerBackground, null, false);
                view.Tag = s.Wrap();

                return(view);
            });
            spinnerYear.ItemSelected += (sender, args) =>
            {
                ViewModel.CurrentlySelectedCustomSeasonYear = (sender as Spinner).SelectedView.Tag.Unwrap <string>();
            };
            spinnerSeason.Adapter = ViewModel.SeasonSeasons.GetAdapter((i, s, arg3) =>
            {
                var view = arg3 ?? BuildBaseItem(Activity, s, ResourceExtension.BrushAnimeItemInnerBackground, null, false);
                view.Tag = s.Wrap();

                return(view);
            });
            spinnerSeason.ItemSelected += (sender, args) =>
            {
                ViewModel.CurrentlySelectedCustomSeasonSeason = (sender as Spinner).SelectedView.Tag.Unwrap <string>();
            };
            _seasonMenu.MenuView.FindViewById(Resource.Id.SeasonSelectionPopupAcceptButton).SetCommand("Click", ViewModel.GoToCustomSeasonCommand);
        }
        private void ShowSeasonMenu()
        {
            _seasonMenu = AnimeListPageFlyoutBuilder.BuildForAnimeSeasonSelection(Activity, AnimeListPageSeasonMenu,
                SelectSeason, ViewModel);
            _seasonMenu.Show();
            var spinnerYear = _seasonMenu.MenuView.FindViewById<Spinner>(Resource.Id.SeasonSelectionPopupYearComboBox);
            var spinnerSeason = _seasonMenu.MenuView.FindViewById<Spinner>(Resource.Id.SeasonSelectionPopupSeasonComboBox);
            spinnerYear.Adapter = ViewModel.SeasonYears.GetAdapter((i, s, arg3) =>
            {
                var view = arg3 ?? BuildBaseItem(Activity, s, ResourceExtension.BrushAnimeItemInnerBackground, null, false);
                view.Tag = s.Wrap();

                return view;
            });
            spinnerYear.ItemSelected += (sender, args) =>
            {
                ViewModel.CurrentlySelectedCustomSeasonYear = (sender as Spinner).SelectedView.Tag.Unwrap<string>();
            };
            spinnerSeason.Adapter = ViewModel.SeasonSeasons.GetAdapter((i, s, arg3) =>
            {
                var view = arg3 ?? BuildBaseItem(Activity, s,ResourceExtension.BrushAnimeItemInnerBackground,null,false);
                view.Tag = s.Wrap();

                return view;
            });
            spinnerSeason.ItemSelected += (sender, args) =>
            {
                ViewModel.CurrentlySelectedCustomSeasonSeason = (sender as Spinner).SelectedView.Tag.Unwrap<string>();
            };
            _seasonMenu.MenuView.FindViewById(Resource.Id.SeasonSelectionPopupAcceptButton).SetCommand("Click",ViewModel.GoToCustomSeasonCommand);

        }
Exemplo n.º 7
0
 private void OnTypeChangeButtonClick()
 {
     _menu = RecommendationsFlyoutBuilder.BuildForRecommendationsPage(Activity, RecommendationsPageTypeChangeButton,
                                                                      ViewModel, i =>
     {
         ViewModel.CurrentWorkMode = RecommendationsPageWorkMode.Anime;
         _menu.Dismiss(true);
     });
     _menu.Show();
 }
        //private void OnCompleted(ImageViewAsync imageViewAsync)
        //{
        //    Activity?.RunOnUiThread(() =>
        //    {
        //        try
        //        {
        //            var parent = (imageViewAsync.Parent as View);
        //            var vm = parent.Tag.Unwrap<WallpaperItemViewModel>();
        //            if (!string.IsNullOrEmpty(vm.Resolution))
        //                return;

        //            var bounds = imageViewAsync.Drawable.Bounds;
        //            vm.Resolution = $"{bounds.Right}x{bounds.Bottom}";
        //            parent.FindViewById<TextView>(Resource.Id.WallpapersPageItemResolution).Text = vm.Resolution;

        //            imageViewAsync.Visibility = ViewStates.Visible;
        //        }
        //        catch (Exception)
        //        {
        //            // user navigated out and image has loaded in background
        //        }

        //    });
        //}

        private void OnLongClickAction(View view)
        {
            _menuContext = view.Tag.Unwrap <WallpaperItemViewModel>();
            _menu        = FlyoutMenuBuilder.BuildGenericFlyout(Context, view, new List <string>
            {
                "Save",
                "Copy link & open waifu2x",
                "Open on reddit",
                "Copy link",
            }, OnMenuSelected);
            _menu.Show();
        }
Exemplo n.º 9
0
 private void OnTopAnimeMore(View view)
 {
     _moreMenu = FlyoutMenuBuilder.BuildGenericFlyout(this, view,
                                                      Enum.GetValues(typeof(TopAnimeType)).Cast <TopAnimeType>().Select(type => type.ToString()).ToList(),
                                                      i =>
     {
         ViewModel.Navigate(PageIndex.PageTopAnime, AnimeListPageNavigationArgs.TopAnime((TopAnimeType)i));
         _moreMenu.Dismiss(true);
         _drawer.CloseDrawer();
     });
     _moreMenu.Show();
 }
Exemplo n.º 10
0
 private void OnAnimeListMore(View view)
 {
     _moreMenu = FlyoutMenuBuilder.BuildGenericFlyout(this, view,
                                                      Enum.GetValues(typeof(AnimeStatus)).Cast <AnimeStatus>().Select(type => Utilities.StatusToString((int)type)).ToList(),
                                                      i =>
     {
         ViewModel.Navigate(PageIndex.PageTopAnime, new AnimeListPageNavigationArgs(i, AnimeListWorkModes.Anime));
         _moreMenu.Dismiss(true);
         _drawer.CloseDrawer();
     });
     _moreMenu.Show();
 }
Exemplo n.º 11
0
        protected override void RootContainerInit()
        {
            ForumIndexPageBoardItemIcon.Typeface = FontManager.GetTypeface(Context, FontManager.TypefacePath);
            if (!ViewModel.ArePeekPostsAvailable)
            {
                _binding = this.SetBinding(() => _parentViewModel.LoadingSideContentVisibility).WhenSourceChanges(() =>
                {
                    if (_parentViewModel.LoadingSideContentVisibility)
                    {
                        ForumIndexPageBoardItemBoardProgressBar.Visibility = ViewStates.Visible;
                        ForumIndexPageBoardItemPeekPostSection.Visibility  = ViewStates.Invisible;
                    }
                    else
                    {
                        ForumIndexPageBoardItemBoardProgressBar.Visibility = ViewStates.Gone;
                        ForumIndexPageBoardItemPeekPostSection.Visibility  = ViewStates.Visible;
                        OnFinishedLoading();
                        BindModelFull();
                        _binding?.Detach();
                        _binding = null;
                    }
                });
            }

            ForumIndexPageBoardItemRootContainer.SetOnLongClickListener(new OnLongClickListener(view =>
            {
                var pinned = ViewModelLocator.ForumsMain.PinnedBoards.Contains(ViewModel.Board);
                _menu      = FlyoutMenuBuilder.BuildGenericFlyout(Context, ForumIndexPageBoardItemRootContainer,
                                                                  new List <string> {
                    pinned ? "Remove from favourites" :  "Add to favourites"
                }, i =>
                {
                    if (pinned)
                    {
                        ViewModelLocator.ForumsMain.RemovePinnedBoardCommand.Execute(ViewModel.Board);
                    }
                    else
                    {
                        ViewModel.AddToFavouritesCommand.Execute(ViewModel.Board);
                    }

                    _menu.Dismiss(true);
                });
                _menu.Show();
            }));

            ForumIndexPageBoardItemPeekPost1Title.Click +=
                (sender, args) => _parentViewModel.GoToLastPostCommand.Execute(ViewModel.Entry.PeekPosts.First());

            ForumIndexPageBoardItemPeekPost2Title.Click +=
                (sender, args) => _parentViewModel.GoToLastPostCommand.Execute(ViewModel.Entry.PeekPosts.Last());
        }
Exemplo n.º 12
0
 private void ForumsMainPageMoreButtonOnClick(object sender, EventArgs eventArgs)
 {
     if (_moreMenu == null)
     {
         _moreMenu = FlyoutMenuBuilder.BuildGenericFlyout(Activity, ForumsMainPageMoreButton, new List <string>
         {
             "My recent topics",
             "My watched topics",
             "MALClient's topic",
         }, OnMoreMenuSelected);
     }
     _moreMenu.Show();
 }
Exemplo n.º 13
0
 private void OnLongClickAction(View view)
 {
     _menu = FlyoutMenuBuilder.BuildGenericFlyout(Context, view,
                                                  new List <string> {
         "Pin", "Pin to lastpost"
     }, i =>
     {
         var vm = (view.Parent as View).Tag.Unwrap <ForumTopicEntryViewModel>();
         if (i == 0)
         {
             vm.PinCommand.Execute(null);
         }
         else
         {
             vm.PinLastpostCommand.Execute(null);
         }
         _menu.Dismiss(true);
     });
     _menu.Show();
 }
        public void Show()
        {
            if (_menu == null)
            {
                _menu = BuildForPinnedPosts();
            }
            _menu.Show();

            if (_list != null)
            {
                var count = _viewModel.PinnedTopics.Count;
                count = count > 3 ? 3 : count;
                var height = 0;
                for (int i = 0; i < count; i++)
                {
                    height += DimensionsHelper.DpToPx(65);
                }
                var param = _list.LayoutParameters;
                param.Height           = height;
                _list.LayoutParameters = param;
            }
        }
Exemplo n.º 15
0
 private void ShowFilterMenu()
 {
     _filterMenu = AnimeListPageFlyoutBuilder.BuildForAnimeStatusSelection(MainActivity.CurrentContext,
         AnimeListPageFilterMenu,
         OnFilterMenuSelectionChanged, (AnimeStatus) ViewModel.CurrentStatus,ViewModel.IsMangaWorkMode);
     _filterMenu.Show();
 }
Exemplo n.º 16
0
 private void MoreButtonOnClick()
 {
     _menu = AnimeItemFlyoutBuilder.BuildForAnimeItem(MainActivity.CurrentContext, AnimeListItemImgPlaceholder, null,
                                                      OnMoreFlyoutSelection, true);
     _menu.Show();
 }
Exemplo n.º 17
0
        private void InitBindings()
        {
            Bindings.Add(
                this.SetBinding(() => ViewModel.CurrentStatus,
                                () => MainPageCurrentStatus.Text));


            Bindings.Add(
                this.SetBinding(() => ViewModel.RefreshButtonVisibility,
                                () => MainPageRefreshButton.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));
            MainPageRefreshButton.Click += (sender, args) => ViewModel.RefreshDataCommand.Execute(null);

            Bindings.Add(
                this.SetBinding(() => ViewModel.SearchToggleVisibility,
                                () => MainPageSearchView.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));
            Bindings.Add(
                this.SetBinding(() => ViewModel.SearchInputVisibility).WhenSourceChanges(() =>
            {
                MainPageSearchView.Iconified = !ViewModel.SearchInputVisibility;
                if (ViewModel.SearchInputVisibility)
                {
                    MainPageSearchView.SetQuery(ViewModel.CurrentSearchQuery, false);
                }
                MainPageSearchView.ClearFocus();
            }));


            Bindings.Add(this.SetBinding(() => ViewModel.CurrentStatusSub).WhenSourceChanges(() =>
            {
                MainPageCurrentSatusSubtitle.Text = ViewModel.CurrentStatusSub;
                if (string.IsNullOrEmpty(ViewModel.CurrentStatusSub))
                {
                    MainPageCurrentSatusSubtitle.Visibility = ViewStates.Gone;
                    MainPageCurrentStatus.SetMaxLines(2);
                }
                else
                {
                    MainPageCurrentSatusSubtitle.Visibility = ViewStates.Visible;
                    MainPageCurrentStatus.SetMaxLines(1);
                }
            }));

            _searchFrame = MainPageSearchView.FindViewById(Resource.Id.search_edit_frame);

            Bindings.Add(this.SetBinding(() => ViewModel.SearchToggleLock).WhenSourceChanges(
                             () =>
            {
                if (ViewModel.SearchToggleLock)
                {
                    MainPageSearchView.FindViewById(Resource.Id.search_close_btn).Alpha     = 0;
                    MainPageSearchView.FindViewById(Resource.Id.search_close_btn).Clickable = false;
                    if (ViewModel.CurrentMainPage == PageIndex.PageSearch)
                    {
                        InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                        imm.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.NotAlways);
                    }
                }
                else
                {
                    MainPageSearchView.FindViewById(Resource.Id.search_close_btn).Alpha     = 1;
                    MainPageSearchView.FindViewById(Resource.Id.search_close_btn).Clickable = true;
                }
            }));

            //MainPageSearchView.LayoutChange += MainPageSearchViewOnLayoutChange;

            //var padding = (int)(11*Resources.DisplayMetrics.Density);
            //searchBtn.SetScaleType(ImageView.ScaleType.FitEnd);
            //searchBtn.SetPadding(padding, padding, padding, padding);
            var observer       = _searchFrame.ViewTreeObserver;
            var prevVisibility = _searchFrame.Visibility;

            observer.GlobalLayout += (sender, args) =>
            {
                if (prevVisibility == _searchFrame.Visibility)
                {
                    return;
                }
                prevVisibility = _searchFrame.Visibility;
                MainPageCurrentStatus.Visibility = Converters.VisibilityInverterConverter(_searchFrame.Visibility);
                var param = MainPageSearchView.LayoutParameters as LinearLayout.LayoutParams;
                Debug.WriteLine(_searchFrame.Visibility);
                if (_searchFrame.Visibility == ViewStates.Visible)
                {
                    var diff = ViewModel.SearchToggleStatus != true;
                    ViewModel.SearchToggleStatus = true;
                    param.Width = ViewGroup.LayoutParams.MatchParent;
                    param.SetMargins(0, 0, DimensionsHelper.DpToPx(20), 0);
                    param.Weight = 1;
                    if (diff)
                    {
                        MainPageSearchView.RequestFocusFromTouch();
                        InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                        imm.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.None);
                    }
                }
                else
                {
                    var diff = ViewModel.SearchToggleStatus != false;
                    ViewModel.SearchToggleStatus = false;
                    param.Width = (int)DimensionsHelper.DpToPx(50);
                    param.SetMargins(0, 0, 0, 0);
                    param.Weight = 0;
                    if (diff)
                    {
                        InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                        imm.HideSoftInputFromWindow(MainPageSearchView.WindowToken, HideSoftInputFlags.None);
                    }
                }
            };

            _searchSuggestionAdapter = new SimpleCursorAdapter(this, Resource.Layout.SuggestionItem,
                                                               null, new string[] { "hint" }, new int[]
            {
                Resource.Id.SuggestionItemTextView
            });

            //
            MainPageStatusContainer.SetOnClickListener(new OnClickListener(view =>
            {
                if (ViewModel.CurrentMainPage == PageIndex.PageAnimeList)
                {
                    if (ViewModelLocator.AnimeList.WorkMode == AnimeListWorkModes.SeasonalAnime)
                    {
                        _upperFilterMenu = FlyoutMenuBuilder.BuildGenericFlyout(this, MainPageCurrentStatus,
                                                                                ViewModelLocator.AnimeList.SeasonSelection.Select(season => season.Name).ToList(),
                                                                                OnUpperStatusSeasonSelected);
                    }
                    else
                    {
                        _upperFilterMenu = AnimeListPageFlyoutBuilder.BuildForAnimeStatusSelection(this, MainPageCurrentStatus,
                                                                                                   OnUpperFlyoutStatusChanged, (AnimeStatus)ViewModelLocator.AnimeList.CurrentStatus,
                                                                                                   ViewModelLocator.AnimeList.IsMangaWorkMode);
                    }

                    _upperFilterMenu.Show();
                }
            }));


            Bindings.Add(this.SetBinding(() => ViewModel.MediaElementVisibility)
                         .WhenSourceChanges(() =>
            {
                if (ViewModel.MediaElementVisibility)
                {
                    MainPageVideoViewContainer.Visibility = ViewStates.Visible;
                    MainPageVideoView.Visibility          = ViewStates.Visible;
                    MainUpperNavBar.Visibility            = ViewStates.Gone;
                    MainPageVideoView.SetZOrderOnTop(true);
                    _drawer?.DrawerLayout.SetDrawerLockMode(DrawerLayout.LockModeLockedClosed);
                }
                else
                {
                    MainPageVideoViewContainer.Visibility = ViewStates.Gone;
                    MainPageVideoView.Visibility          = ViewStates.Gone;
                    MainUpperNavBar.Visibility            = ViewStates.Visible;
                    MainPageVideoView.SetZOrderOnTop(false);
                    _drawer?.DrawerLayout.SetDrawerLockMode(DrawerLayout.LockModeUnlocked);
                    ViewModelLocator.NavMgr.ResetOneTimeOverride();
                }
            }));



            Bindings.Add(
                this.SetBinding(() => ViewModel.MediaElementSource).WhenSourceChanges(() =>
            {
                if (string.IsNullOrEmpty(ViewModel.MediaElementSource))
                {
                    return;
                }

                var mediaController = new MediaController(this);
                mediaController.SetAnchorView(MainPageVideoView);
                MainPageVideoView.SetMediaController(mediaController);
                MainPageVideoView.SetVideoURI(Uri.Parse(ViewModel.MediaElementSource));
                MainPageVideoView.RequestFocus();
            }));

            MainPageSearchView.SuggestionsAdapter = _searchSuggestionAdapter;
            MainPageSearchView.QueryTextChange   += MainPageSearchViewOnQueryTextChange;
            MainPageSearchView.QueryTextSubmit   += MainPageSearchViewOnQueryTextSubmit;
            MainPageSearchView.SuggestionClick   += MainPageSearchViewOnSuggestionClick;
            MainPageCloseVideoButton.Click       += MainPageCloseVideoButtonOnClick;
            MainPageCopyVideoLinkButton.Click    += MainPageCopyVideoLinkButtonOnClick;
            MainPageVideoView.Prepared           += MainPageVideoViewOnPrepared;
            MainPageSearchView.Visibility         = ViewStates.Visible;
            ((EditText)MainPageSearchView.FindViewById(Resource.Id.search_src_text)).SetTextColor(Color.White);


            MainPageHamburgerButton.Click += MainPageHamburgerButtonOnClick;
            ViewModel.PropertyChanged     += ViewModelOnPropertyChanged;
            BuildDrawer();
            _drawer.OnDrawerItemClickListener = new HamburgerItemClickListener(OnHamburgerItemClick);

            MainPageCloseVideoButton.SetZ(0);
            MainPageCopyVideoLinkButton.SetZ(0);
        }
Exemplo n.º 18
0
        protected override void InitBindings()
        {
            AnimeDetailsPagePivot.Adapter = new AnimeDetailsPagerAdapter(ChildFragmentManager);
            AnimeDetailsPageTabStrip.SetViewPager(AnimeDetailsPagePivot);
            AnimeDetailsPageTabStrip.CenterTabs();
            AnimeDetailsPagePivot.SetCurrentItem(_navArgs.SourceTabIndex, false);
            AnimeDetailsPagePivot.OffscreenPageLimit = 7;

            AnimeDetailsPagePivot.AddOnPageChangeListener(
                new OnPageChangedListener(i => ViewModel.DetailsPivotSelectedIndex = i));

            Bindings.Add(
                this.SetBinding(() => ViewModel.MyScoreBind,
                                () => AnimeDetailsPageScoreButton.Text));
            Bindings.Add(
                this.SetBinding(() => ViewModel.MyStatusBind,
                                () => AnimeDetailsPageStatusButton.Text));
            Bindings.Add(
                this.SetBinding(() => ViewModel.MyEpisodesBind,
                                () => AnimeDetailsPageWatchedButton.Text));
            Bindings.Add(
                this.SetBinding(() => ViewModel.MyVolumesBind,
                                () => AnimeDetailsPageReadVolumesButton.Text));
            Bindings.Add(
                this.SetBinding(() => ViewModel.LoadingGlobal,
                                () => AnimeDetailsPageLoadingOverlay.Visibility)
                .ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(this.SetBinding(() => ViewModel.IsIncrementButtonEnabled).WhenSourceChanges(() =>
            {
                AnimeDetailsPageIncrementButton.Alpha = ViewModel.IsIncrementButtonEnabled ? 1 : .35f;
            }));
            Bindings.Add(this.SetBinding(() => ViewModel.IsDecrementButtonEnabled).WhenSourceChanges(() =>
            {
                AnimeDetailsPageDecrementButton.Alpha = ViewModel.IsDecrementButtonEnabled ? 1 : .35f;
            }));

            Bindings.Add(this.SetBinding(() => ViewModel.AddAnimeVisibility)
                         .WhenSourceChanges(() =>
            {
                if (ViewModel.AddAnimeVisibility)
                {
                    AnimeDetailsPageIncDecSection.Visibility   = ViewStates.Gone;
                    AnimeDetailsPageUpdateSection.Visibility   = ViewStates.Gone;
                    AnimeDetailsPageAddSection.Visibility      = ViewStates.Visible;
                    AnimeDetailsPageFavouriteButton.Visibility = ViewStates.Gone;
                }
                else
                {
                    AnimeDetailsPageIncDecSection.Visibility   = ViewStates.Visible;
                    AnimeDetailsPageUpdateSection.Visibility   = ViewStates.Visible;
                    AnimeDetailsPageAddSection.Visibility      = ViewStates.Gone;
                    AnimeDetailsPageFavouriteButton.Visibility = ViewStates.Visible;
                }
            }));

            Bindings.Add(
                this.SetBinding(() => ViewModel.DetailsPivotSelectedIndex)
                .WhenSourceChanges(
                    () => AnimeDetailsPagePivot.SetCurrentItem(ViewModel.DetailsPivotSelectedIndex, true)));


            Bindings.Add(
                this.SetBinding(() => ViewModel.IsFavourite)
                .WhenSourceChanges(() =>
            {
                if (ViewModel.IsFavourite)
                {
                    AnimeDetailsPageFavouriteButton.ImageTintList = ColorStateList.ValueOf(Color.White);
                    AnimeDetailsPageFavouriteButton.SetImageResource(Resource.Drawable.icon_favourite);
                    AnimeDetailsPageFavouriteButton.SetBackgroundResource(ResourceExtension.AccentColourRes);
                }
                else
                {
                    AnimeDetailsPageFavouriteButton.ImageTintList = ColorStateList.ValueOf(new Color(ResourceExtension.BrushText));
                    AnimeDetailsPageFavouriteButton.SetImageResource(Resource.Drawable.icon_unfavourite);
                    AnimeDetailsPageFavouriteButton.SetBackgroundColor(Color.Transparent);
                }
            }));


            Bindings.Add(this.SetBinding(() => ViewModel.AnimeMode)
                         .WhenSourceChanges(() =>
            {
                if (ViewModel.AnimeMode)
                {
                    AnimeDetailsPageReadVolumesButton.Visibility    =
                        AnimeDetailsPageReadVolumesLabel.Visibility = ViewStates.Gone;
                }
                else
                {
                    AnimeDetailsPageReadVolumesButton.Visibility    =
                        AnimeDetailsPageReadVolumesLabel.Visibility = ViewStates.Visible;
                }
            }));

            Bindings.Add(this.SetBinding(() => ViewModel.DetailImage)
                         .WhenSourceChanges(() =>
            {
                AnimeDetailsPageShowCoverImage.Visibility = ViewStates.Invisible;
                AnimeDetailsPageShowCoverImage.Into(ViewModel.DetailImage);
            }));

            Bindings.Add(
                this.SetBinding(() => ViewModel.LoadingUpdate,
                                () => AnimeDetailsPageLoadingUpdateSpinner.Visibility)
                .ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(
                this.SetBinding(() => ViewModel.IsAddAnimeButtonEnabled,
                                () => AnimeDetailsPageAddButton.Enabled));

            AnimeDetailsPageFavouriteButton.SetOnClickListener(
                new OnClickListener(view => ViewModel.ToggleFavouriteCommand.Execute(null)));
            AnimeDetailsPageIncrementButton.SetOnClickListener(
                new OnClickListener(view => ViewModel.IncrementEpsCommand.Execute(null)));
            AnimeDetailsPageDecrementButton.SetOnClickListener(
                new OnClickListener(view => ViewModel.DecrementEpsCommand.Execute(null)));
            AnimeDetailsPageAddButton.SetOnClickListener(
                new OnClickListener(view => ViewModel.AddAnimeCommand.Execute(null)));
            AnimeDetailsPageMoreButton.SetOnClickListener(new OnClickListener(view =>
            {
                _menu = AnimeDetailsPageMoreFlyoutBuilder.BuildForAnimeDetailsPage(Activity, ViewModel,
                                                                                   AnimeDetailsPageMoreButton,
                                                                                   OnMoreFlyoutClick);
                _menu.Show();
            }));
            ImageContainer.SetOnClickListener(new OnClickListener(view =>
                                                                  KeyImageDialog.Instance.ShowDialog(Activity, ViewModel.DetailImage)));



            //OneTime

            AnimeDetailsPageWatchedLabel.Text = ViewModel.WatchedEpsLabel;



            //

            //Events
            AnimeDetailsPageStatusButton.SetOnClickListener(
                new OnClickListener(view => AnimeDetailsPageStatusButtonOnClick()));
            AnimeDetailsPageScoreButton.SetOnClickListener(
                new OnClickListener(view => AnimeDetailsPageScoreButtonOnClick()));
            AnimeDetailsPageWatchedButton.SetOnClickListener(
                new OnClickListener(view => AnimeDetailsPageWatchedButtonOnClick()));
            AnimeDetailsPageReadVolumesButton.SetOnClickListener(
                new OnClickListener(view => AnimeDetailsPageVolumesButtonOnClick()));
        }
Exemplo n.º 19
0
 private void OnTagsButtonClick(View view)
 {
     _tagsMenu = AnimeItemFlyoutBuilder.BuildForAnimeItemTags(Context, view, ViewModel,
                                                              () => _tagsMenu.Dismiss(true));
     _tagsMenu.Show();
 }
Exemplo n.º 20
0
        protected override void InitBindings()
        {
            AnimeDetailsPagePivot.Adapter = new AnimeDetailsPagerAdapter(FragmentManager);
            AnimeDetailsPageTabStrip.SetViewPager(AnimeDetailsPagePivot);
           
            Bindings = new Dictionary<int, List<Binding>>();

            Bindings.Add(AnimeDetailsPageScoreButton.Id, new List<Binding>());
            Bindings[AnimeDetailsPageScoreButton.Id].Add(
                this.SetBinding(() => ViewModel.MyScoreBind,
                    () => AnimeDetailsPageScoreButton.Text));

            Bindings.Add(AnimeDetailsPageStatusButton.Id, new List<Binding>());
            Bindings[AnimeDetailsPageStatusButton.Id].Add(
                this.SetBinding(() => ViewModel.MyStatusBind,
                    () => AnimeDetailsPageStatusButton.Text));

            Bindings.Add(AnimeDetailsPageWatchedButton.Id, new List<Binding>());
            Bindings[AnimeDetailsPageWatchedButton.Id].Add(
                this.SetBinding(() => ViewModel.MyEpisodesBind,
                    () => AnimeDetailsPageWatchedButton.Text));

            Bindings.Add(AnimeDetailsPageReadVolumesButton.Id, new List<Binding>());
            Bindings[AnimeDetailsPageReadVolumesButton.Id].Add(
                this.SetBinding(() => ViewModel.MyVolumesBind,
                    () => AnimeDetailsPageReadVolumesButton.Text));

            Bindings.Add(AnimeDetailsPageLoadingOverlay.Id, new List<Binding>());
            Bindings[AnimeDetailsPageLoadingOverlay.Id].Add(
                this.SetBinding(() => ViewModel.LoadingGlobal,
                    () => AnimeDetailsPageLoadingOverlay.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(AnimeDetailsPageAddSection.Id, new List<Binding>());
            Bindings[AnimeDetailsPageAddSection.Id].Add(
                this.SetBinding(() => ViewModel.AddAnimeVisibility,
                    () => AnimeDetailsPageAddSection.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(AnimeDetailsPageIncrementButton.Id, new List<Binding>());
            Bindings[AnimeDetailsPageIncrementButton.Id].Add(
                this.SetBinding(() => ViewModel.IsIncrementButtonEnabled,
                    () => AnimeDetailsPageIncrementButton.Enabled));

            Bindings.Add(AnimeDetailsPageDecrementButton.Id, new List<Binding>());
            Bindings[AnimeDetailsPageDecrementButton.Id].Add(
                this.SetBinding(() => ViewModel.IsDecrementButtonEnabled,
                    () => AnimeDetailsPageDecrementButton.Enabled));

            Bindings.Add(AnimeDetailsPageUpdateSection.Id, new List<Binding>());
            Bindings[AnimeDetailsPageUpdateSection.Id].Add(
                this.SetBinding(() => ViewModel.AddAnimeVisibility,
                    () => AnimeDetailsPageUpdateSection.Visibility).ConvertSourceToTarget(Converters.BoolToVisibilityInverted));

            Bindings.Add(AnimeDetailsPageIncDecSection.Id, new List<Binding>());
            Bindings[AnimeDetailsPageIncDecSection.Id].Add(
                this.SetBinding(() => ViewModel.AddAnimeVisibility,
                    () => AnimeDetailsPageIncDecSection.Visibility).ConvertSourceToTarget(Converters.BoolToVisibilityInverted));

            AnimeDetailsPageIncrementButton.SetCommand("Click",ViewModel.IncrementEpsCommand);
            AnimeDetailsPageDecrementButton.SetCommand("Click",ViewModel.DecrementEpsCommand);
            AnimeDetailsPageMoreButton.Click +=
                (sender, args) =>
                {
                   _menu = AnimeDetailsPageMoreFlyoutBuilder.BuildForAnimeDetailsPage(Activity, AnimeDetailsPageMoreButton,
                        ViewModel);
                   _menu.Show();
                };
            AnimeDetailsPageAddButton.SetCommand("Click",ViewModel.AddAnimeCommand);
            
            //OneTime

            AnimeDetailsPageWatchedLabel.Text = ViewModel.WatchedEpsLabel;


            //

            //Events
            AnimeDetailsPageStatusButton.Click += AnimeDetailsPageStatusButtonOnClick;
            AnimeDetailsPageScoreButton.Click += AnimeDetailsPageScoreButtonOnClick;
            AnimeDetailsPageWatchedButton.Click += AnimeDetailsPageWatchedButtonOnClick;
            AnimeDetailsPageReadVolumesButton.Click += AnimeDetailsPageVolumesButtonOnClick;


        }
Exemplo n.º 21
0
 private void ShowDisplayMenu()
 {
     _displayMenu = AnimeListPageFlyoutBuilder.BuildForAnimeListDisplayModeSelection(MainActivity.CurrentContext,
                                                                                     AnimeListPageDisplayMenu, ViewModel.DisplayModes, OnDisplayModeSelectionChanged, ViewModel.DisplayMode);
     _displayMenu.Show();
 }
Exemplo n.º 22
0
 private void ShowSortMenu()
 {
     _sortingMenu = AnimeListPageFlyoutBuilder.BuildForAnimeSortingSelection(MainActivity.CurrentContext,
         AnimeListPageSortMenu,
         OnSortingMenuSelectionChanged, ViewModel.SortOption);
     _sortingMenu.Show();
 }
Exemplo n.º 23
0
 private void ShowDisplayMenu()
 {
     _displayMenu = AnimeListPageFlyoutBuilder.BuildForAnimeListDisplayModeSelection(MainActivity.CurrentContext,
         AnimeListPageDisplayMenu, ViewModel.DisplayModes, OnDisplayModeSelectionChanged, ViewModel.DisplayMode);
     _displayMenu.Show();
 }
Exemplo n.º 24
0
        protected override void InitBindings()
        {
            var swipeRefresh = RootView as SwipeRefreshLayout;
            var footerHolder = new FrameLayout(Context)
            {
                LayoutParameters = new AbsListView.LayoutParams(-1, -2)
            };
            var footer = new Button(Context)
            {
                Text             = "Load more",
                LayoutParameters = new ViewGroup.LayoutParams(-1, -2)
            };

            footer.SetAllCaps(false);
            footer.BackgroundTintList = ColorStateList.ValueOf(new Color(ResourceExtension.AccentColourDark));
            footer.SetOnClickListener(new OnClickListener(view => ViewModel.LoadMoreCommand.Execute(null)));
            footer.SetTextColor(Color.White);
            footerHolder.AddView(footer);
            _loadMoreFooter = footerHolder;


            RootView.ViewTreeObserver.GlobalLayout += (sender, args) =>
            {
                Rect r = new Rect();
                RootView.GetWindowVisibleDisplayFrame(r);
                int keypadHeight = RootView.RootView.Height - r.Bottom;

                if (keypadHeight > RootView.Height * 0.15)
                {
                    AnimeListPageActionButton.Hide();
                }
                else
                {
                    AnimeListPageActionButton.Show();
                }
            };
            //AnimeListPageGridView.ScrollingCacheEnabled = false;


            Bindings.Add(
                this.SetBinding(() => ViewModel.Loading,
                                () => AnimeListPageLoadingSpinner.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));


            Bindings.Add(
                this.SetBinding(() => ViewModel.AppbarBtnPinTileVisibility,
                                () => AnimeListPageSeasonMenu.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(
                this.SetBinding(() => ViewModel.AppBtnSortingVisibility,
                                () => AnimeListPageSortMenu.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(
                this.SetBinding(() => ViewModel.EmptyNoticeVisibility,
                                () => AnimeListPageEmptyNotice.Visibility)
                .ConvertSourceToTarget(Converters.BoolToVisibility));

            ViewModel.PropertyChanged         += AnimeListOnPropertyChanged;
            ViewModel.ScrollIntoViewRequested += ViewModelOnScrollIntoViewRequested;


            AnimeListPageActionButton.LongClickable = true;
            AnimeListPageActionButton.SetOnLongClickListener(new OnLongClickListener(view =>
            {
                var items = new List <string>();

                if (ViewModel.AppBtnListSourceVisibility)
                {
                    items.Add(FabMenuSetListSource);
                }
                if (ViewModel.LoadAllDetailsButtonVisiblity)
                {
                    items.Add(FabMenuLoadDetails);
                }
                items.Add(FabMenuDisplayModes);
                _fabMenu = FlyoutMenuBuilder.BuildGenericFlyout(Activity, AnimeListPageActionButton, items,
                                                                OnFabMenuItemClicked);
                _fabMenu.Tag = items;
                _fabMenu.Show();
            }));

            swipeRefresh.NestedScrollingEnabled = true;
            swipeRefresh.Refresh += (sender, args) =>
            {
                swipeRefresh.Refreshing = false;

                ViewModel.RefreshCommand.Execute(null);
            };

            Bindings.Add(this.SetBinding(() => ViewModel.WorkMode).WhenSourceChanges(InitActionMenu));

            InitDrawer();
        }
Exemplo n.º 25
0
        protected override void InitBindings()
        {
            AnimeDetailsPagePivot.Adapter = new AnimeDetailsPagerAdapter(FragmentManager);
            AnimeDetailsPageTabStrip.SetViewPager(AnimeDetailsPagePivot);

            Bindings = new List <Binding>();


            Bindings.Add(
                this.SetBinding(() => ViewModel.MyScoreBind,
                                () => AnimeDetailsPageScoreButton.Text));


            Bindings.Add(
                this.SetBinding(() => ViewModel.MyStatusBind,
                                () => AnimeDetailsPageStatusButton.Text));


            Bindings.Add(
                this.SetBinding(() => ViewModel.MyEpisodesBind,
                                () => AnimeDetailsPageWatchedButton.Text));


            Bindings.Add(
                this.SetBinding(() => ViewModel.MyVolumesBind,
                                () => AnimeDetailsPageReadVolumesButton.Text));


            Bindings.Add(
                this.SetBinding(() => ViewModel.LoadingGlobal,
                                () => AnimeDetailsPageLoadingOverlay.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));


            Bindings.Add(
                this.SetBinding(() => ViewModel.AddAnimeVisibility,
                                () => AnimeDetailsPageAddSection.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));


            Bindings.Add(
                this.SetBinding(() => ViewModel.IsIncrementButtonEnabled,
                                () => AnimeDetailsPageIncrementButton.Enabled));


            Bindings.Add(
                this.SetBinding(() => ViewModel.IsDecrementButtonEnabled,
                                () => AnimeDetailsPageDecrementButton.Enabled));


            Bindings.Add(
                this.SetBinding(() => ViewModel.AddAnimeVisibility,
                                () => AnimeDetailsPageUpdateSection.Visibility).ConvertSourceToTarget(Converters.BoolToVisibilityInverted));


            Bindings.Add(
                this.SetBinding(() => ViewModel.AddAnimeVisibility,
                                () => AnimeDetailsPageIncDecSection.Visibility).ConvertSourceToTarget(Converters.BoolToVisibilityInverted));


            Bindings.Add(
                this.SetBinding(() => ViewModel.DetailsPivotSelectedIndex).WhenSourceChanges(() => AnimeDetailsPagePivot.SetCurrentItem(ViewModel.DetailsPivotSelectedIndex, true)));


            Bindings.Add(
                this.SetBinding(() => ViewModel.IsFavourite).WhenSourceChanges(() =>
            {
                AnimeDetailsPageFavouriteButton.SetImageResource(ViewModel.IsFavourite
                        ? Resource.Drawable.icon_favourite
                        : Resource.Drawable.icon_fav_outline);
            }));

            AnimeDetailsPageFavouriteButton.SetCommand("Click", ViewModel.ToggleFavouriteCommand);
            AnimeDetailsPageIncrementButton.SetCommand("Click", ViewModel.IncrementEpsCommand);
            AnimeDetailsPageDecrementButton.SetCommand("Click", ViewModel.DecrementEpsCommand);
            AnimeDetailsPageMoreButton.Click +=
                (sender, args) =>
            {
                _menu = AnimeDetailsPageMoreFlyoutBuilder.BuildForAnimeDetailsPage(Activity, AnimeDetailsPageMoreButton,
                                                                                   ViewModel);
                _menu.Show();
            };
            AnimeDetailsPageAddButton.SetCommand("Click", ViewModel.AddAnimeCommand);


            //OneTime

            AnimeDetailsPageWatchedLabel.Text = ViewModel.WatchedEpsLabel;



            //

            //Events
            AnimeDetailsPageStatusButton.Click      += AnimeDetailsPageStatusButtonOnClick;
            AnimeDetailsPageScoreButton.Click       += AnimeDetailsPageScoreButtonOnClick;
            AnimeDetailsPageWatchedButton.Click     += AnimeDetailsPageWatchedButtonOnClick;
            AnimeDetailsPageReadVolumesButton.Click += AnimeDetailsPageVolumesButtonOnClick;
        }
Exemplo n.º 26
0
        private void InitBindings()
        {
            Bindings.Add(MainPageCurrentStatus.Id, new List <Binding>());
            Bindings[MainPageCurrentStatus.Id].Add(
                this.SetBinding(() => ViewModel.CurrentStatus,
                                () => MainPageCurrentStatus.Text));

            Bindings.Add(MainPageRefreshButton.Id, new List <Binding>());
            Bindings[MainPageRefreshButton.Id].Add(
                this.SetBinding(() => ViewModel.RefreshButtonVisibility,
                                () => MainPageRefreshButton.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(MainPageSearchView.Id, new List <Binding>());
            Bindings[MainPageSearchView.Id].Add(
                this.SetBinding(() => ViewModel.SearchToggleVisibility,
                                () => MainPageSearchView.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));
            Bindings[MainPageSearchView.Id].Add(
                this.SetBinding(() => ViewModel.SearchInputVisibility).WhenSourceChanges(() =>
            {
                MainPageSearchView.Iconified = !ViewModel.SearchInputVisibility;
                if (ViewModel.SearchInputVisibility)
                {
                    MainPageSearchView.SetQuery(ViewModel.CurrentSearchQuery, false);
                }
                MainPageSearchView.ClearFocus();
            }));

            Bindings.Add(MainPageCurrentSatusSubtitle.Id, new List <Binding>());
            Bindings[MainPageCurrentSatusSubtitle.Id].Add(
                this.SetBinding(() => ViewModel.CurrentStatusSub,
                                () => MainPageCurrentSatusSubtitle.Text));

            _searchFrame = MainPageSearchView.FindViewById(Resource.Id.search_edit_frame);

            Bindings[MainPageSearchView.Id].Add(this.SetBinding(() => ViewModel.SearchToggleLock).WhenSourceChanges(
                                                    () =>
            {
                if (ViewModel.SearchToggleLock)
                {
                    MainPageSearchView.FindViewById(Resource.Id.search_close_btn).Alpha     = 0;
                    MainPageSearchView.FindViewById(Resource.Id.search_close_btn).Clickable = false;
                }
                else
                {
                    MainPageSearchView.FindViewById(Resource.Id.search_close_btn).Alpha     = 1;
                    MainPageSearchView.FindViewById(Resource.Id.search_close_btn).Clickable = true;
                }
            }));

            //MainPageSearchView.LayoutChange += MainPageSearchViewOnLayoutChange;

            //var padding = (int)(11*Resources.DisplayMetrics.Density);
            //searchBtn.SetScaleType(ImageView.ScaleType.FitEnd);
            //searchBtn.SetPadding(padding, padding, padding, padding);
            var observer = _searchFrame.ViewTreeObserver;

            observer.GlobalLayout += (sender, args) =>
            {
                MainPageCurrentStatus.Visibility = Converters.VisibilityInverterConverter(_searchFrame.Visibility);
                var param = MainPageSearchView.LayoutParameters as LinearLayout.LayoutParams;
                if (_searchFrame.Visibility == ViewStates.Visible)
                {
                    ViewModel.SearchToggleStatus = true;
                    param.Width  = ViewGroup.LayoutParams.WrapContent;
                    param.Weight = 1;
                }
                else
                {
                    ViewModel.SearchToggleStatus = false;
                    param.Width  = (int)DimensionsHelper.DpToPx(50);
                    param.Weight = 0;
                }
            };

            _searchSuggestionAdapter = new SimpleCursorAdapter(this, Resource.Layout.SuggestionItem,
                                                               null, new string[] { "hint" }, new int[]
            {
                Resource.Id.SuggestionItemTextView
            });

            //
            MainPageCurrentStatus.Clickable = true;
            MainPageCurrentStatus.SetOnClickListener(new OnClickListener(view =>
            {
                if (ViewModel.CurrentMainPage == PageIndex.PageAnimeList)
                {
                    _upperFilterMenu = AnimeListPageFlyoutBuilder.BuildForAnimeStatusSelection(this, MainPageCurrentStatus,
                                                                                               OnUpperFlyoutStatusChanged, (AnimeStatus)ViewModelLocator.AnimeList.CurrentStatus,
                                                                                               ViewModelLocator.AnimeList.IsMangaWorkMode);
                    _upperFilterMenu.Show();
                }
            }));



            Bindings.Add(MainPageVideoViewContainer.Id, new List <Binding>());
            Bindings[MainPageVideoViewContainer.Id].Add(
                this.SetBinding(() => ViewModel.MediaElementVisibility,
                                () => MainPageVideoViewContainer.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(MainPageVideoView.Id, new List <Binding>());
            Bindings[MainPageVideoView.Id].Add(
                this.SetBinding(() => ViewModel.MediaElementSource).WhenSourceChanges(() =>
            {
                if (string.IsNullOrEmpty(ViewModel.MediaElementSource))
                {
                    return;
                }

                var mediaController = new MediaController(this);
                mediaController.SetAnchorView(MainPageVideoView);

                MainPageVideoView.SetMediaController(mediaController);
                MainPageVideoView.SetVideoURI(Uri.Parse(ViewModel.MediaElementSource));
                MainPageVideoView.RequestFocus();
            }));

            MainPageSearchView.SuggestionsAdapter = _searchSuggestionAdapter;
            MainPageSearchView.QueryTextChange   += MainPageSearchViewOnQueryTextChange;
            MainPageSearchView.QueryTextSubmit   += MainPageSearchViewOnQueryTextSubmit;
            MainPageSearchView.SuggestionClick   += MainPageSearchViewOnSuggestionClick;
            MainPageSearchView.QueryTextSubmit   += MainPageSearchViewOnQueryTextSubmit;
            MainPageCloseVideoButton.Click       += MainPageCloseVideoButtonOnClick;
            MainPageVideoView.Prepared           += MainPageVideoViewOnPrepared;
            MainPageSearchView.Visibility         = ViewStates.Visible;


            MainPageHamburgerButton.Click += MainPageHamburgerButtonOnClick;
            ViewModel.PropertyChanged     += ViewModelOnPropertyChanged;
            BuildDrawer();
            _drawer.OnDrawerItemClickListener = new HamburgerItemClickListener(OnHamburgerItemClick);
        }