mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 08:30:44 +00:00
Fixed the "Remove Watched" bug
Reverted changes and fixed bug in a different way
This commit is contained in:
parent
fd8e92cf77
commit
38c4a1ed85
@ -404,7 +404,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||||||
.firstElement()
|
.firstElement()
|
||||||
.zipWith(historyIdsMaybe, (playlist, historyStreamIds) -> {
|
.zipWith(historyIdsMaybe, (playlist, historyStreamIds) -> {
|
||||||
// Remove Watched, Functionality data
|
// Remove Watched, Functionality data
|
||||||
final List<PlaylistStreamEntry> notWatchedItems = new ArrayList<>();
|
final List<PlaylistStreamEntry> itemsToKeep = new ArrayList<>();
|
||||||
final boolean isThumbnailPermanent = playlistManager
|
final boolean isThumbnailPermanent = playlistManager
|
||||||
.getIsPlaylistThumbnailPermanent(playlistId);
|
.getIsPlaylistThumbnailPermanent(playlistId);
|
||||||
boolean thumbnailVideoRemoved = false;
|
boolean thumbnailVideoRemoved = false;
|
||||||
@ -415,7 +415,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||||||
playlistItem.getStreamId());
|
playlistItem.getStreamId());
|
||||||
|
|
||||||
if (indexInHistory < 0) {
|
if (indexInHistory < 0) {
|
||||||
notWatchedItems.add(playlistItem);
|
itemsToKeep.add(playlistItem);
|
||||||
} else if (!isThumbnailPermanent && !thumbnailVideoRemoved
|
} else if (!isThumbnailPermanent && !thumbnailVideoRemoved
|
||||||
&& playlistManager.getPlaylistThumbnail(playlistId)
|
&& playlistManager.getPlaylistThumbnail(playlistId)
|
||||||
.equals(playlistItem.getStreamEntity().getThumbnailUrl())) {
|
.equals(playlistItem.getStreamEntity().getThumbnailUrl())) {
|
||||||
@ -436,7 +436,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||||||
|
|
||||||
if (indexInHistory < 0 || (streamStateEntity != null
|
if (indexInHistory < 0 || (streamStateEntity != null
|
||||||
&& !streamStateEntity.isFinished(duration))) {
|
&& !streamStateEntity.isFinished(duration))) {
|
||||||
notWatchedItems.add(playlistItem);
|
itemsToKeep.add(playlistItem);
|
||||||
} else if (!isThumbnailPermanent && !thumbnailVideoRemoved
|
} else if (!isThumbnailPermanent && !thumbnailVideoRemoved
|
||||||
&& playlistManager.getPlaylistThumbnail(playlistId)
|
&& playlistManager.getPlaylistThumbnail(playlistId)
|
||||||
.equals(playlistItem.getStreamEntity().getThumbnailUrl())) {
|
.equals(playlistItem.getStreamEntity().getThumbnailUrl())) {
|
||||||
@ -445,17 +445,17 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Pair<>(notWatchedItems, thumbnailVideoRemoved);
|
return new Pair<>(itemsToKeep, thumbnailVideoRemoved);
|
||||||
});
|
});
|
||||||
|
|
||||||
disposables.add(streamsMaybe.subscribeOn(Schedulers.io())
|
disposables.add(streamsMaybe.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(flow -> {
|
.subscribe(flow -> {
|
||||||
final List<PlaylistStreamEntry> notWatchedItems = flow.first;
|
final List<PlaylistStreamEntry> itemsToKeep = flow.first;
|
||||||
final boolean thumbnailVideoRemoved = flow.second;
|
final boolean thumbnailVideoRemoved = flow.second;
|
||||||
|
|
||||||
itemListAdapter.clearStreamItemList();
|
itemListAdapter.clearStreamItemList();
|
||||||
itemListAdapter.addItems(notWatchedItems);
|
itemListAdapter.addItems(itemsToKeep);
|
||||||
saveChanges();
|
saveChanges();
|
||||||
|
|
||||||
if (thumbnailVideoRemoved) {
|
if (thumbnailVideoRemoved) {
|
||||||
|
Loading…
Reference in New Issue
Block a user