private void ShowEmptyPage() { try { SwipeRefreshLayout.Refreshing = false; if (TopSongsSoundAdapter.SoundsList.Count > 0) { if (TopSongsInflated == null) { TopSongsInflated = TopSongsViewStub.Inflate(); } TemplateRecyclerInflater recyclerInflater = new TemplateRecyclerInflater(); recyclerInflater.InflateLayout <SoundDataObject>(Activity, TopSongsInflated, TopSongsSoundAdapter, TemplateRecyclerInflater.TypeLayoutManager.LinearLayoutManagerHorizontal, 0, true, Context.GetText(Resource.String.Lbl_TopSongs_Title)); if (!recyclerInflater.MainLinear.HasOnClickListeners) { recyclerInflater.MainLinear.Click += null; recyclerInflater.MainLinear.Click += TopSongsMoreOnClick; } } if (AlbumsAdapter.AlbumsList?.Count > 0) { if (TopAlbumsInflated == null) { TopAlbumsInflated = TopAlbumsViewStub.Inflate(); } TemplateRecyclerInflater recyclerInflater = new TemplateRecyclerInflater(); recyclerInflater.InflateLayout <DataAlbumsObject>(Activity, TopAlbumsInflated, AlbumsAdapter, TemplateRecyclerInflater.TypeLayoutManager.GridLayoutManagerVertical, 2, true, Context.GetText(Resource.String.Lbl_TopAlbums_Title)); if (!recyclerInflater.MainLinear.HasOnClickListeners) { recyclerInflater.MainLinear.Click += null; recyclerInflater.MainLinear.Click += TopAlbumsMoreOnClick; } } if (TopSongsSoundAdapter.SoundsList?.Count == 0 && AlbumsAdapter.AlbumsList?.Count == 0) { if (Inflated == null) { Inflated = EmptyStateLayout.Inflate(); } EmptyStateInflater x = new EmptyStateInflater(); x.InflateLayout(Inflated, EmptyStateInflater.Type.NoSound); if (x.EmptyStateButton.HasOnClickListeners) { x.EmptyStateButton.Click += null; } EmptyStateLayout.Visibility = ViewStates.Visible; } } catch (Exception e) { SwipeRefreshLayout.Refreshing = false; Console.WriteLine(e); } }
private void ShowEmptyPage() { try { LoadingLayout.Visibility = ViewStates.Gone; if (LatestSongsAdapter.SoundsList?.Count > 0) { if (LatestSongsInflated == null) { LatestSongsInflated = LatestSongsViewStub.Inflate(); } TemplateRecyclerInflater recyclerInflater = new TemplateRecyclerInflater(); recyclerInflater.InflateLayout <SoundDataObject>(Activity, LatestSongsInflated, LatestSongsAdapter, TemplateRecyclerInflater.TypeLayoutManager.LinearLayoutManagerHorizontal, 0, true, Context.GetText(Resource.String.Lbl_LatestSongs_Title)); if (!recyclerInflater.MainLinear.HasOnClickListeners) { recyclerInflater.MainLinear.Click += null; recyclerInflater.MainLinear.Click += LatestSongsMoreOnClick; } } if (TopSongsAdapter.SoundsList?.Count > 0) { if (TopSongsInflated == null) { TopSongsInflated = TopSongsViewStub.Inflate(); } TemplateRecyclerInflater recyclerInflater = new TemplateRecyclerInflater(); recyclerInflater.InflateLayout <SoundDataObject>(Activity, TopSongsInflated, TopSongsAdapter, TemplateRecyclerInflater.TypeLayoutManager.LinearLayoutManagerHorizontal, 0, true, Context.GetText(Resource.String.Lbl_TopSongs_Title)); if (!recyclerInflater.MainLinear.HasOnClickListeners) { recyclerInflater.MainLinear.Click += null; recyclerInflater.MainLinear.Click += TopSongsMoreOnClick; } } if (AlbumsAdapter.AlbumsList?.Count > 0) { if (AlbumsInflated == null) { AlbumsInflated = AlbumsViewStub.Inflate(); } TemplateRecyclerInflater recyclerInflater = new TemplateRecyclerInflater(); recyclerInflater.InflateLayout <DataAlbumsObject>(Activity, AlbumsInflated, AlbumsAdapter, TemplateRecyclerInflater.TypeLayoutManager.LinearLayoutManagerHorizontal, 0, true, Context.GetText(Resource.String.Lbl_Albums)); if (!recyclerInflater.MainLinear.HasOnClickListeners) { recyclerInflater.MainLinear.Click += null; recyclerInflater.MainLinear.Click += AlbumsMoreOnClick; } } if (StoreAdapter.SoundsList?.Count > 0) { if (StoreInflated == null) { StoreInflated = StoreViewStub.Inflate(); } TemplateRecyclerInflater recyclerInflater = new TemplateRecyclerInflater(); recyclerInflater.InflateLayout <SoundDataObject>(Activity, StoreInflated, StoreAdapter, TemplateRecyclerInflater.TypeLayoutManager.LinearLayoutManagerHorizontal, 0, true, Context.GetText(Resource.String.Lbl_Store_Title)); if (!recyclerInflater.MainLinear.HasOnClickListeners) { recyclerInflater.MainLinear.Click += null; recyclerInflater.MainLinear.Click += StoreMoreOnClick; } } if (ActivitiesAdapter.ActivityList?.Count > 0) { if (ActivitiesInflated == null) { ActivitiesInflated = ActivitiesViewStub.Inflate(); } TemplateRecyclerInflater recyclerInflater = new TemplateRecyclerInflater(); recyclerInflater.InflateLayout <ActivityDataObject>(Activity, ActivitiesInflated, ActivitiesAdapter, TemplateRecyclerInflater.TypeLayoutManager.LinearLayoutManagerVertical, 0, true, Context.GetText(Resource.String.Lbl_Activities_Title)); if (!recyclerInflater.MainLinear.HasOnClickListeners) { recyclerInflater.MainLinear.Click += null; recyclerInflater.MainLinear.Click += ActivitiesMoreOnClick; } } if (LatestSongsAdapter.SoundsList?.Count == 0 && TopSongsAdapter.SoundsList?.Count == 0 && AlbumsAdapter.AlbumsList?.Count == 0 && StoreAdapter.SoundsList?.Count == 0 && ActivitiesAdapter.ActivityList?.Count == 0) { if (Inflated == null) { Inflated = EmptyStateLayout.Inflate(); } EmptyStateInflater x = new EmptyStateInflater(); x.InflateLayout(Inflated, EmptyStateInflater.Type.NoSound); if (x.EmptyStateButton.HasOnClickListeners) { x.EmptyStateButton.Click += null; } EmptyStateLayout.Visibility = ViewStates.Visible; } } catch (Exception e) { LoadingLayout.Visibility = ViewStates.Gone; Console.WriteLine(e); } }