diff --git a/app/src/main/java/org/schabi/newpipe/local/history/StatisticsPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/local/history/StatisticsPlaylistFragment.java index 43b7f1c0d..f5d01489c 100644 --- a/app/src/main/java/org/schabi/newpipe/local/history/StatisticsPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/history/StatisticsPlaylistFragment.java @@ -57,6 +57,7 @@ public class StatisticsPlaylistFragment @State Parcelable itemsListState; private StatisticSortMode sortMode = StatisticSortMode.LAST_PLAYED; + private boolean includeFullyWatched = true; private StatisticPlaylistControlBinding headerBinding; private PlaylistControlBinding playlistControlBinding; @@ -78,6 +79,14 @@ public class StatisticsPlaylistFragment return null; } Collections.sort(results, comparator.reversed()); + + // Filter Fully Watched + if (!includeFullyWatched) { + return results.stream() + .filter(e -> e.getStreamEntity().getDuration() != e.getProgressMillis() / 1000) + .toList(); + } + return results; } @@ -277,6 +286,8 @@ public class StatisticsPlaylistFragment PlayButtonHelper.initPlaylistControlClickListener(activity, playlistControlBinding, this); headerBinding.sortButton.setOnClickListener(view -> toggleSortMode()); + headerBinding.fullyWatchedFilterButtonCheckBox + .setOnClickListener(view -> toggleIncludeFullyWatched()); hideLoading(); } @@ -313,6 +324,11 @@ public class StatisticsPlaylistFragment startLoading(true); } + private void toggleIncludeFullyWatched() { + includeFullyWatched = !includeFullyWatched; + startLoading(true); + } + private PlayQueue getPlayQueueStartingAt(final StreamStatisticsEntry infoItem) { return getPlayQueue(Math.max(itemListAdapter.getItemsList().indexOf(infoItem), 0)); } diff --git a/app/src/main/res/layout/statistic_playlist_control.xml b/app/src/main/res/layout/statistic_playlist_control.xml index 36540d32e..0aa9bfcfb 100644 --- a/app/src/main/res/layout/statistic_playlist_control.xml +++ b/app/src/main/res/layout/statistic_playlist_control.xml @@ -5,37 +5,73 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + android:orientation="horizontal"> - + - - + + + + + + + + + + + + + HTTP error 403 received from server while playing, likely caused by an IP ban or streaming URL deobfuscation issues %1$s refused to provide data, asking for a login to confirm the requester is not a bot.\n\nYour IP might have been temporarily banned by %1$s, you can wait some time or switch to a different IP (for example by turning on/off a VPN, or by switching from WiFi to mobile data). This content is not available for the currently selected content country.\n\nChange your selection from \"Settings > Content > Default content country\". + Fully Watched