From 8de367e03f1d9b1640e730e35988a292f022cbf5 Mon Sep 17 00:00:00 2001 From: decarvalhobo Date: Mon, 2 Dec 2019 22:20:43 +0100 Subject: [PATCH] fix issue: thumbnail update when element deleted + thumbnail update when element added and no thumbnail --- .../local/dialog/PlaylistAppendDialog.java | 16 +++++++++++++--- .../local/playlist/LocalPlaylistFragment.java | 14 ++++++++++++++ .../local/playlist/LocalPlaylistManager.java | 4 ++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/dialog/PlaylistAppendDialog.java b/app/src/main/java/org/schabi/newpipe/local/dialog/PlaylistAppendDialog.java index ac02b0b37..72df33576 100644 --- a/app/src/main/java/org/schabi/newpipe/local/dialog/PlaylistAppendDialog.java +++ b/app/src/main/java/org/schabi/newpipe/local/dialog/PlaylistAppendDialog.java @@ -152,9 +152,19 @@ public final class PlaylistAppendDialog extends PlaylistDialog { final Toast successToast = Toast.makeText(getContext(), R.string.playlist_add_stream_success, Toast.LENGTH_SHORT); - playlistDisposables.add(manager.appendToPlaylist(playlist.uid, streams) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(ignored -> successToast.show())); + if(playlist.thumbnailUrl.equals("https://i.ytimg.com/")){ //empty playlist + 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) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(ignored -> successToast.show())); + } getDialog().dismiss(); } diff --git a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java index c60cdac3f..35451d344 100644 --- a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java @@ -413,10 +413,24 @@ public class LocalPlaylistFragment extends BaseLocalListFragment modifyPlaylist(final long playlistId, @Nullable final String name, @Nullable final String thumbnailUrl) {