diff --git a/app/src/main/java/com/cappielloantonio/play/ui/fragment/ArtistPageFragment.java b/app/src/main/java/com/cappielloantonio/play/ui/fragment/ArtistPageFragment.java index 18796082..8bc2ade1 100644 --- a/app/src/main/java/com/cappielloantonio/play/ui/fragment/ArtistPageFragment.java +++ b/app/src/main/java/com/cappielloantonio/play/ui/fragment/ArtistPageFragment.java @@ -173,7 +173,10 @@ public class ArtistPageFragment extends Fragment { albumArtistPageOrSimilarAdapter = new AlbumArtistPageOrSimilarAdapter(requireContext()); bind.albumsRecyclerView.setAdapter(albumArtistPageOrSimilarAdapter); - artistPageViewModel.getAlbumList().observe(requireActivity(), songs -> albumArtistPageOrSimilarAdapter.setItems(songs)); + artistPageViewModel.getAlbumList().observe(requireActivity(), albums -> { + if (bind != null) bind.artistPageAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE); + albumArtistPageOrSimilarAdapter.setItems(albums); + }); } private void initSimilarArtistsView() { diff --git a/app/src/main/java/com/cappielloantonio/play/ui/fragment/HomeFragment.java b/app/src/main/java/com/cappielloantonio/play/ui/fragment/HomeFragment.java index ea92eb9e..b1b8e9ef 100644 --- a/app/src/main/java/com/cappielloantonio/play/ui/fragment/HomeFragment.java +++ b/app/src/main/java/com/cappielloantonio/play/ui/fragment/HomeFragment.java @@ -162,6 +162,7 @@ public class HomeFragment extends Fragment { if (albums.size() < 10) reorder(); if (bind != null) bind.homeMostPlayedAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE); + mostPlayedAlbumAdapter.setItems(albums); }); } @@ -173,7 +174,9 @@ public class HomeFragment extends Fragment { recentlyPlayedAlbumAdapter = new AlbumAdapter(requireContext()); bind.recentlyPlayedAlbumsRecyclerView.setAdapter(recentlyPlayedAlbumAdapter); homeViewModel.getRecentlyPlayedAlbumList().observe(requireActivity(), albums -> { - if (bind != null) bind.homeRecentlyPlayedAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE); + if (bind != null) + bind.homeRecentlyPlayedAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE); + recentlyPlayedAlbumAdapter.setItems(albums); }); } @@ -191,7 +194,9 @@ public class HomeFragment extends Fragment { }); bind.yearsRecyclerView.setAdapter(yearAdapter); homeViewModel.getYearList().observe(requireActivity(), years -> { - if (bind != null) bind.homeFlashbackSector.setVisibility(!years.isEmpty() ? View.VISIBLE : View.GONE); + if (bind != null) + bind.homeFlashbackSector.setVisibility(!years.isEmpty() ? View.VISIBLE : View.GONE); + yearAdapter.setItems(years); }); } @@ -202,8 +207,10 @@ public class HomeFragment extends Fragment { starredSongAdapter = new SongHorizontalAdapter(activity, requireContext(), getChildFragmentManager()); bind.starredTracksRecyclerView.setAdapter(starredSongAdapter); homeViewModel.getStarredTracks().observe(requireActivity(), songs -> { - if (bind != null) bind.homeStarredTracksSector.setVisibility(!songs.isEmpty() ? View.VISIBLE : View.GONE); - bind.starredTracksRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(songs.size(), 5), GridLayoutManager.HORIZONTAL, false)); + if (bind != null) { + bind.homeStarredTracksSector.setVisibility(!songs.isEmpty() ? View.VISIBLE : View.GONE); + bind.starredTracksRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(songs.size(), 5), GridLayoutManager.HORIZONTAL, false)); + } starredSongAdapter.setItems(songs); }); @@ -217,8 +224,10 @@ public class HomeFragment extends Fragment { starredAlbumAdapter = new AlbumHorizontalAdapter(activity, requireContext(), getChildFragmentManager()); bind.starredAlbumsRecyclerView.setAdapter(starredAlbumAdapter); homeViewModel.getStarredAlbums().observe(requireActivity(), albums -> { - if (bind != null) bind.homeStarredAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE); - bind.starredAlbumsRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(albums.size(), 5), GridLayoutManager.HORIZONTAL, false)); + if (bind != null) { + bind.homeStarredAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE); + bind.starredAlbumsRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(albums.size(), 5), GridLayoutManager.HORIZONTAL, false)); + } starredAlbumAdapter.setItems(albums); }); @@ -232,8 +241,10 @@ public class HomeFragment extends Fragment { starredArtistAdapter = new ArtistHorizontalAdapter(activity, requireContext(), getChildFragmentManager()); bind.starredArtistsRecyclerView.setAdapter(starredArtistAdapter); homeViewModel.getStarredArtists().observe(requireActivity(), artists -> { - if (bind != null) bind.homeStarredArtistsSector.setVisibility(!artists.isEmpty() ? View.VISIBLE : View.GONE); - bind.starredArtistsRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(artists.size(), 5), GridLayoutManager.HORIZONTAL, false)); + if (bind != null) { + bind.homeStarredArtistsSector.setVisibility(!artists.isEmpty() ? View.VISIBLE : View.GONE); + bind.starredArtistsRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(artists.size(), 5), GridLayoutManager.HORIZONTAL, false)); + } starredArtistAdapter.setItems(artists); }); @@ -259,7 +270,9 @@ public class HomeFragment extends Fragment { dowanloadedMusicAdapter = new RecentMusicAdapter(activity, requireContext(), getChildFragmentManager()); bind.downloadedTracksRecyclerView.setAdapter(dowanloadedMusicAdapter); homeViewModel.getDownloaded().observe(requireActivity(), downloads -> { - if (bind != null) bind.homeDownloadedTracksSector.setVisibility(!downloads.isEmpty() ? View.VISIBLE : View.GONE); + if (bind != null) + bind.homeDownloadedTracksSector.setVisibility(!downloads.isEmpty() ? View.VISIBLE : View.GONE); + dowanloadedMusicAdapter.setItems(MappingUtil.mapDownload(downloads)); }); } diff --git a/app/src/main/res/layout/fragment_artist_page.xml b/app/src/main/res/layout/fragment_artist_page.xml index d5c52312..f106a37a 100644 --- a/app/src/main/res/layout/fragment_artist_page.xml +++ b/app/src/main/res/layout/fragment_artist_page.xml @@ -120,57 +120,70 @@ android:id="@+id/artist_page_top_songs_sector" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="horizontal"> + android:orientation="vertical" + android:paddingBottom="22dp"> + + + + + + + + + + + + + + - - + android:paddingBottom="8dp" /> - - - - - -