From 6399e3950711e63d7fe4d5b299a8091d4327f4f4 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Sun, 7 Aug 2022 13:40:10 +0530 Subject: [PATCH] Remove from playlist only upon selecting the option and not afterwards. --- .../local/playlist/LocalPlaylistFragment.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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 2938fe0b5..9ace11a46 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 @@ -394,12 +394,14 @@ public class LocalPlaylistFragment extends BaseLocalListFragment historyList.stream().map(StreamHistoryEntry::getStreamId) .collect(Collectors.toList())); - final var streamsFlowable = playlistManager.getPlaylistStreams(playlistId) - .zipWith(historyIdsFlowable, (playlist, historyStreamIds) -> { + final var streamsMaybe = playlistManager.getPlaylistStreams(playlistId) + .firstElement() + .zipWith(historyIdsMaybe, (playlist, historyStreamIds) -> { // Remove Watched, Functionality data final List notWatchedItems = new ArrayList<>(); boolean thumbnailVideoRemoved = false; @@ -418,8 +420,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment(notWatchedItems, thumbnailVideoRemoved); }); - disposables.add(streamsFlowable.subscribeOn(Schedulers.io()) + + disposables.add(streamsMaybe.subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(flow -> { final List notWatchedItems = flow.first;