private async void ViewTreeObserverOnGlobalLayout(object sender, EventArgs eventArgs) { Rect r = new Rect(); RootView.GetWindowVisibleDisplayFrame(r); int keypadHeight = RootView.RootView.Height - r.Bottom; if (keypadHeight > RootView.Height * 0.15) { BottomButtonsSection.Visibility = ViewStates.Gone; } else { await Task.Delay(100); BottomButtonsSection.Visibility = ViewStates.Visible; } }
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(); }