Fix downloaded item implementation

This commit is contained in:
CappielloAntonio 2021-08-11 12:11:14 +02:00
parent 93d61be594
commit b24903fd47
9 changed files with 25 additions and 22 deletions

View file

@ -92,7 +92,9 @@ public class AlbumPageFragment extends Fragment {
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.action_download_album:
DownloadUtil.getDownloadTracker(requireContext()).toggleDownload(albumPageViewModel.getAlbumSongLiveList().getValue());
albumPageViewModel.getAlbumSongLiveList().observe(requireActivity(), songs -> {
DownloadUtil.getDownloadTracker(requireContext()).toggleDownload(songs);
});
return true;
default:
break;

View file

@ -178,7 +178,7 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
}
private void initDownloadedUI() {
if (song.isOffline()) {
if (DownloadUtil.getDownloadTracker(requireContext()).isDownloaded(song)) {
download.setText("Remove");
} else {
download.setText("Download");