mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
Check the number of songs present before performing the action
This commit is contained in:
parent
8cef75c763
commit
b6082cdb16
2 changed files with 8 additions and 1 deletions
|
|
@ -144,7 +144,7 @@ public class AlbumPageFragment extends Fragment {
|
||||||
|
|
||||||
private void initMusicButton() {
|
private void initMusicButton() {
|
||||||
albumPageViewModel.getAlbumSongLiveList().observe(requireActivity(), songs -> {
|
albumPageViewModel.getAlbumSongLiveList().observe(requireActivity(), songs -> {
|
||||||
if (bind != null) {
|
if (bind != null && !songs.isEmpty()) {
|
||||||
bind.albumPagePlayButton.setOnClickListener(v -> {
|
bind.albumPagePlayButton.setOnClickListener(v -> {
|
||||||
QueueRepository queueRepository = new QueueRepository(App.getInstance());
|
QueueRepository queueRepository = new QueueRepository(App.getInstance());
|
||||||
queueRepository.insertAllAndStartNew(songs);
|
queueRepository.insertAllAndStartNew(songs);
|
||||||
|
|
@ -167,6 +167,11 @@ public class AlbumPageFragment extends Fragment {
|
||||||
MusicPlayerRemote.openQueue(songs, 0, true);
|
MusicPlayerRemote.openQueue(songs, 0, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(bind != null && songs.isEmpty()) {
|
||||||
|
bind.albumPagePlayButton.setEnabled(false);
|
||||||
|
bind.albumPageShuffleButton.setEnabled(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,8 @@ public class ArtistPageFragment extends Fragment {
|
||||||
|
|
||||||
MusicPlayerRemote.openQueue(songs, 0, true);
|
MusicPlayerRemote.openQueue(songs, 0, true);
|
||||||
activity.isBottomSheetInPeek(true);
|
activity.isBottomSheetInPeek(true);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(requireContext(), "Error retrieving artist's songs", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue