Exemplo n.º 1
0
        private void ShowEmptyPage()
        {
            try
            {
                MainScrollEvent.IsLoading = false;

                ProgressBarLoader.Visibility = ViewStates.Gone;

                if (PixUserFeedAdapter.PostList.Count > 0)
                {
                    ProfileFeedRecylerView.Visibility = ViewStates.Visible;
                    EmptyStateLayout.Visibility       = ViewStates.Gone;
                }
                else
                {
                    ProfileFeedRecylerView.Visibility = ViewStates.Gone;

                    if (Inflated == null)
                    {
                        Inflated = EmptyStateLayout.Inflate();
                    }

                    EmptyStateInflater x = new EmptyStateInflater();
                    x.InflateLayout(Inflated, EmptyStateInflater.Type.NoPost);
                    if (!x.EmptyStateButton.HasOnClickListeners)
                    {
                        x.EmptyStateButton.Click += null;
                    }
                    EmptyStateLayout.Visibility = ViewStates.Visible;

                    //Remove behavior from AppBarLayout
                    if (ViewCompat.IsLaidOut(AppBarLayoutView))
                    {
                        CoordinatorLayout.LayoutParams appBarLayoutParams = (CoordinatorLayout.LayoutParams)AppBarLayoutView.LayoutParameters;
                        AppBarLayout.Behavior          behavior           = (AppBarLayout.Behavior)appBarLayoutParams.Behavior;
                        behavior.SetDragCallback(new DragRemover());
                    }
                }
            }
            catch (Exception e)
            {
                ProgressBarLoader.Visibility = ViewStates.Gone;
                Console.WriteLine(e);
            }
        }