public void OnRefresh() { try { NewReleasesSoundAdapter.SoundsList.Clear(); NewReleasesSoundAdapter.NotifyDataSetChanged(); RecentlyPlayedSoundAdapter.SoundsList.Clear(); RecentlyPlayedSoundAdapter.NotifyDataSetChanged(); PopularSoundAdapter.SoundsList.Clear(); PopularSoundAdapter.NotifyDataSetChanged(); GenresAdapter.GenresList.Clear(); GenresAdapter.NotifyDataSetChanged(); ArtistsAdapter.ArtistsList.Clear(); ArtistsAdapter.NotifyDataSetChanged(); RecommendedList.Clear(); ViewPagerView.Adapter = null; EmptyStateLayout.Visibility = ViewStates.Gone; StartApiService(); } catch (Exception e) { Console.WriteLine(e); } }
//open sound from Popular private void PopularSoundAdapterOnOnItemClick(object sender, HSoundAdapterClickEventArgs e) { try { if (e.Position > -1) { var item = PopularSoundAdapter.GetItem(e.Position); if (item == null) { return; } Constant.PlayPos = e.Position; GlobalContext?.SoundController?.StartPlaySound(item, PopularSoundAdapter.SoundsList); } } catch (Exception exception) { Console.WriteLine(exception); } }