@@ -405,8 +405,9 @@ public void removeWatchedStreams(final boolean removePartiallyWatched) {
405405 .zipWith (historyIdsMaybe , (playlist , historyStreamIds ) -> {
406406 // Remove Watched, Functionality data
407407 final List <PlaylistStreamEntry > notWatchedItems = new ArrayList <>();
408+ final boolean isThumbnailSet = playlistManager
409+ .getIsPlaylistThumbnailSet (playlistId );
408410 boolean thumbnailVideoRemoved = false ;
409- //TODO: add blocker here
410411
411412 if (removePartiallyWatched ) {
412413 for (final var playlistItem : playlist ) {
@@ -415,7 +416,7 @@ public void removeWatchedStreams(final boolean removePartiallyWatched) {
415416
416417 if (indexInHistory < 0 ) {
417418 notWatchedItems .add (playlistItem );
418- } else if (!thumbnailVideoRemoved
419+ } else if (!isThumbnailSet && ! thumbnailVideoRemoved
419420 && playlistManager .getPlaylistThumbnail (playlistId )
420421 .equals (playlistItem .getStreamEntity ().getThumbnailUrl ())) {
421422 thumbnailVideoRemoved = true ;
@@ -436,7 +437,7 @@ public void removeWatchedStreams(final boolean removePartiallyWatched) {
436437 if (indexInHistory < 0 || (streamStateEntity != null
437438 && !streamStateEntity .isFinished (duration ))) {
438439 notWatchedItems .add (playlistItem );
439- } else if (!thumbnailVideoRemoved
440+ } else if (!isThumbnailSet && ! thumbnailVideoRemoved
440441 && playlistManager .getPlaylistThumbnail (playlistId )
441442 .equals (playlistItem .getStreamEntity ().getThumbnailUrl ())) {
442443 thumbnailVideoRemoved = true ;
@@ -586,13 +587,12 @@ private void changePlaylistName(final String title) {
586587 disposables .add (disposable );
587588 }
588589
589- private void changeThumbnailUrl (final String thumbnailUrl ) {
590- if (playlistManager == null ) {
590+ private void changeThumbnailUrl (final String thumbnailUrl , final boolean isPermanent ) {
591+ if (playlistManager == null || (!isPermanent && playlistManager
592+ .getIsPlaylistThumbnailSet (playlistId ))) {
591593 return ;
592594 }
593595
594- //TODO add blocker here
595-
596596 final Toast successToast = Toast .makeText (getActivity (),
597597 R .string .playlist_thumbnail_change_success ,
598598 Toast .LENGTH_SHORT );
@@ -603,7 +603,7 @@ private void changeThumbnailUrl(final String thumbnailUrl) {
603603 }
604604
605605 final Disposable disposable = playlistManager
606- .changePlaylistThumbnail (playlistId , thumbnailUrl )
606+ .changePlaylistThumbnail (playlistId , thumbnailUrl , isPermanent )
607607 .observeOn (AndroidSchedulers .mainThread ())
608608 .subscribe (ignore -> successToast .show (), throwable ->
609609 showError (new ErrorInfo (throwable , UserAction .REQUESTED_BOOKMARK ,
@@ -612,16 +612,19 @@ private void changeThumbnailUrl(final String thumbnailUrl) {
612612 }
613613
614614 private void updateThumbnailUrl () {
615+ if (playlistManager .getIsPlaylistThumbnailSet (playlistId )) {
616+ return ;
617+ }
618+
615619 final String newThumbnailUrl ;
616- //TODO: add blocker here
617620 if (!itemListAdapter .getItemsList ().isEmpty ()) {
618621 newThumbnailUrl = ((PlaylistStreamEntry ) itemListAdapter .getItemsList ().get (0 ))
619622 .getStreamEntity ().getThumbnailUrl ();
620623 } else {
621624 newThumbnailUrl = "drawable://" + R .drawable .placeholder_thumbnail_playlist ;
622625 }
623626
624- changeThumbnailUrl (newThumbnailUrl );
627+ changeThumbnailUrl (newThumbnailUrl , false );
625628 }
626629
627630 private void deleteItem (final PlaylistStreamEntry item ) {
@@ -789,7 +792,8 @@ context, getPlayQueueStartingAt(item), true))
789792 .setAction (
790793 StreamDialogDefaultEntry .SET_AS_PLAYLIST_THUMBNAIL ,
791794 (f , i ) ->
792- changeThumbnailUrl (item .getStreamEntity ().getThumbnailUrl ()))
795+ changeThumbnailUrl (item .getStreamEntity ().getThumbnailUrl (),
796+ true ))
793797 .setAction (
794798 StreamDialogDefaultEntry .DELETE ,
795799 (f , i ) -> deleteItem (item ))
0 commit comments