Usage of drawable instead of remote image + refactor the append to an empty playlist by just updating the thumbnail before adding the item in it.

This commit is contained in:
decarvalhobo 2019-12-04 19:24:34 +01:00 committed by TobiGr
parent 8feee05eec
commit 752a76eb44
2 changed files with 7 additions and 11 deletions

View File

@ -152,20 +152,16 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
final Toast successToast = Toast.makeText(getContext(),
R.string.playlist_add_stream_success, Toast.LENGTH_SHORT);
if(playlist.thumbnailUrl.equals("https://i.ytimg.com/")){
playlistDisposables.add(manager.createPlaylist(playlist.name, streams)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(ignored -> successToast.show()));
playlistDisposables.add(manager.deletePlaylist(playlist.uid)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(ignored -> successToast.show()));
}
else {
playlistDisposables.add(manager.appendToPlaylist(playlist.uid, streams)
if(playlist.thumbnailUrl.equals("drawable://" + R.drawable.dummy_thumbnail_playlist)){
playlistDisposables.add(manager.changePlaylistThumbnail(playlist.uid,streams.get(0).getThumbnailUrl())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(ignored -> successToast.show()));
}
playlistDisposables.add(manager.appendToPlaylist(playlist.uid, streams)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(ignored -> successToast.show()));
getDialog().dismiss();
}
}

View File

@ -419,7 +419,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
if(!itemListAdapter.getItemsList().isEmpty()){
newThumbnailUrl = ((PlaylistStreamEntry)itemListAdapter.getItemsList().get(0)).thumbnailUrl;
}
else newThumbnailUrl = "https://i.ytimg.com/";
else newThumbnailUrl = "drawable://" + R.drawable.dummy_thumbnail_playlist;
changeThumbnailUrl(newThumbnailUrl);
}