From 8ea98b64aa81ac15f3d01e2764be38b50220644e Mon Sep 17 00:00:00 2001 From: LingYinTianMeng <2632252014@qq.com> Date: Sun, 17 Apr 2022 22:23:03 +0800 Subject: [PATCH] fix issue #7563 --- .../local/playlist/LocalPlaylistFragment.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 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 0eb56d716..7cd2a3ec1 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 @@ -414,14 +414,21 @@ public class LocalPlaylistFragment extends BaseLocalListFragment streamStatesIter = recordManager .loadLocalStreamStateBatch(playlist).blockingGet().iterator(); - while (playlistIter.hasNext()) { final PlaylistStreamEntry playlistItem = playlistIter.next(); final int indexInHistory = Collections.binarySearch(historyStreamIds, playlistItem.getStreamId()); - - final boolean hasState = streamStatesIter.next() != null; - if (indexInHistory < 0 || hasState) { + final StreamStateEntity streamStateEntity = streamStatesIter.next(); + final long duration = playlistItem.toStreamInfoItem().getDuration(); + boolean isFinished = false; + if (streamStateEntity != null) { + isFinished = streamStateEntity.isFinished(duration); + } + final boolean isNotWatchedItem = (streamStateEntity != null + && !isFinished); + if (indexInHistory < 0) { + notWatchedItems.add(playlistItem); + } else if (isNotWatchedItem) { notWatchedItems.add(playlistItem); } else if (!thumbnailVideoRemoved && playlistManager.getPlaylistThumbnail(playlistId)