mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Implemented resource count before showing the affected sector
This commit is contained in:
parent
ccddf3bf3f
commit
562d437da7
3 changed files with 82 additions and 53 deletions
|
|
@ -173,7 +173,10 @@ public class ArtistPageFragment extends Fragment {
|
||||||
|
|
||||||
albumArtistPageOrSimilarAdapter = new AlbumArtistPageOrSimilarAdapter(requireContext());
|
albumArtistPageOrSimilarAdapter = new AlbumArtistPageOrSimilarAdapter(requireContext());
|
||||||
bind.albumsRecyclerView.setAdapter(albumArtistPageOrSimilarAdapter);
|
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() {
|
private void initSimilarArtistsView() {
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,7 @@ public class HomeFragment extends Fragment {
|
||||||
if (albums.size() < 10) reorder();
|
if (albums.size() < 10) reorder();
|
||||||
if (bind != null)
|
if (bind != null)
|
||||||
bind.homeMostPlayedAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE);
|
bind.homeMostPlayedAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
mostPlayedAlbumAdapter.setItems(albums);
|
mostPlayedAlbumAdapter.setItems(albums);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -173,7 +174,9 @@ public class HomeFragment extends Fragment {
|
||||||
recentlyPlayedAlbumAdapter = new AlbumAdapter(requireContext());
|
recentlyPlayedAlbumAdapter = new AlbumAdapter(requireContext());
|
||||||
bind.recentlyPlayedAlbumsRecyclerView.setAdapter(recentlyPlayedAlbumAdapter);
|
bind.recentlyPlayedAlbumsRecyclerView.setAdapter(recentlyPlayedAlbumAdapter);
|
||||||
homeViewModel.getRecentlyPlayedAlbumList().observe(requireActivity(), albums -> {
|
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);
|
recentlyPlayedAlbumAdapter.setItems(albums);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +194,9 @@ public class HomeFragment extends Fragment {
|
||||||
});
|
});
|
||||||
bind.yearsRecyclerView.setAdapter(yearAdapter);
|
bind.yearsRecyclerView.setAdapter(yearAdapter);
|
||||||
homeViewModel.getYearList().observe(requireActivity(), years -> {
|
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);
|
yearAdapter.setItems(years);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -202,8 +207,10 @@ public class HomeFragment extends Fragment {
|
||||||
starredSongAdapter = new SongHorizontalAdapter(activity, requireContext(), getChildFragmentManager());
|
starredSongAdapter = new SongHorizontalAdapter(activity, requireContext(), getChildFragmentManager());
|
||||||
bind.starredTracksRecyclerView.setAdapter(starredSongAdapter);
|
bind.starredTracksRecyclerView.setAdapter(starredSongAdapter);
|
||||||
homeViewModel.getStarredTracks().observe(requireActivity(), songs -> {
|
homeViewModel.getStarredTracks().observe(requireActivity(), songs -> {
|
||||||
if (bind != null) bind.homeStarredTracksSector.setVisibility(!songs.isEmpty() ? View.VISIBLE : View.GONE);
|
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));
|
bind.starredTracksRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(songs.size(), 5), GridLayoutManager.HORIZONTAL, false));
|
||||||
|
}
|
||||||
starredSongAdapter.setItems(songs);
|
starredSongAdapter.setItems(songs);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -217,8 +224,10 @@ public class HomeFragment extends Fragment {
|
||||||
starredAlbumAdapter = new AlbumHorizontalAdapter(activity, requireContext(), getChildFragmentManager());
|
starredAlbumAdapter = new AlbumHorizontalAdapter(activity, requireContext(), getChildFragmentManager());
|
||||||
bind.starredAlbumsRecyclerView.setAdapter(starredAlbumAdapter);
|
bind.starredAlbumsRecyclerView.setAdapter(starredAlbumAdapter);
|
||||||
homeViewModel.getStarredAlbums().observe(requireActivity(), albums -> {
|
homeViewModel.getStarredAlbums().observe(requireActivity(), albums -> {
|
||||||
if (bind != null) bind.homeStarredAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE);
|
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));
|
bind.starredAlbumsRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(albums.size(), 5), GridLayoutManager.HORIZONTAL, false));
|
||||||
|
}
|
||||||
starredAlbumAdapter.setItems(albums);
|
starredAlbumAdapter.setItems(albums);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -232,8 +241,10 @@ public class HomeFragment extends Fragment {
|
||||||
starredArtistAdapter = new ArtistHorizontalAdapter(activity, requireContext(), getChildFragmentManager());
|
starredArtistAdapter = new ArtistHorizontalAdapter(activity, requireContext(), getChildFragmentManager());
|
||||||
bind.starredArtistsRecyclerView.setAdapter(starredArtistAdapter);
|
bind.starredArtistsRecyclerView.setAdapter(starredArtistAdapter);
|
||||||
homeViewModel.getStarredArtists().observe(requireActivity(), artists -> {
|
homeViewModel.getStarredArtists().observe(requireActivity(), artists -> {
|
||||||
if (bind != null) bind.homeStarredArtistsSector.setVisibility(!artists.isEmpty() ? View.VISIBLE : View.GONE);
|
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));
|
bind.starredArtistsRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(artists.size(), 5), GridLayoutManager.HORIZONTAL, false));
|
||||||
|
}
|
||||||
starredArtistAdapter.setItems(artists);
|
starredArtistAdapter.setItems(artists);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -259,7 +270,9 @@ public class HomeFragment extends Fragment {
|
||||||
dowanloadedMusicAdapter = new RecentMusicAdapter(activity, requireContext(), getChildFragmentManager());
|
dowanloadedMusicAdapter = new RecentMusicAdapter(activity, requireContext(), getChildFragmentManager());
|
||||||
bind.downloadedTracksRecyclerView.setAdapter(dowanloadedMusicAdapter);
|
bind.downloadedTracksRecyclerView.setAdapter(dowanloadedMusicAdapter);
|
||||||
homeViewModel.getDownloaded().observe(requireActivity(), downloads -> {
|
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));
|
dowanloadedMusicAdapter.setItems(MappingUtil.mapDownload(downloads));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,12 @@
|
||||||
<!-- Label and button -->
|
<!-- Label and button -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/artist_page_top_songs_sector"
|
android:id="@+id/artist_page_top_songs_sector"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="22dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
@ -147,8 +153,14 @@
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp" />
|
||||||
android:paddingBottom="16dp" />
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/artist_page_albums_sector"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/HeadlineTextView"
|
style="@style/HeadlineTextView"
|
||||||
|
|
@ -170,6 +182,7 @@
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:paddingEnd="8dp"
|
android:paddingEnd="8dp"
|
||||||
android:paddingBottom="8dp" />
|
android:paddingBottom="8dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/similar_artist_sector"
|
android:id="@+id/similar_artist_sector"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue