From db335d5cec3b77be37d897279973f1fbf94537af Mon Sep 17 00:00:00 2001 From: Grady Clark <50427197+GradyClark@users.noreply.github.com> Date: Thu, 16 Apr 2020 12:58:16 -0500 Subject: [PATCH] Removed redundant code reorganized code --- .../local/playlist/LocalPlaylistFragment.java | 44 +++++++++++-------- app/src/main/res/values/strings.xml | 2 - 2 files changed, 25 insertions(+), 21 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 6af10bf21..088615f9c 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 @@ -362,18 +362,18 @@ public class LocalPlaylistFragment extends BaseLocalListFragment removeWatchedStreams(false)) .setNeutralButton( R.string.remove_watched_popup_yes_and_partially_watched_videos, (DialogInterface d, int id) -> removeWatchedStreams(true)) - .setNegativeButton(R.string.remove_watched_popup_cancel, - (DialogInterface d, int id) -> d.cancel()); - builder.create().show(); + .setNegativeButton(R.string.cancel, + (DialogInterface d, int id) -> d.cancel()) + .create() + .show(); break; default: return super.onOptionsItemSelected(item); @@ -388,22 +388,23 @@ public class LocalPlaylistFragment extends BaseLocalListFragment { - boolean localRemovePartiallyWatched = (boolean) flow.blockingFirst(); - List playlist - = (List) flow.blockingLast(); - HistoryRecordManager recordManager = new HistoryRecordManager(getContext()); + .map((List playlist) -> { + //Playlist data Iterator playlistIter = playlist.iterator(); + + //History data + HistoryRecordManager recordManager = new HistoryRecordManager(getContext()); Iterator historyIter = recordManager .getStreamHistorySortedById().blockingFirst().iterator(); - List notWatchedItems = new ArrayList<>(); Iterator streamStatesIter = null; + + //Remove Watched, Functionality data + List notWatchedItems = new ArrayList<>(); boolean thumbnailVideoRemoved = false; - if (!localRemovePartiallyWatched) { + if (!removePartiallyWatched) { streamStatesIter = recordManager.loadLocalStreamStateBatch(playlist) .blockingGet().iterator(); } @@ -414,7 +415,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragmentRemove watched Remove watched videos? "Videos that have been watched\nbefore and after being added to the playlist will be removed.\nAre you sure? This cannot be undone! - Yes - Cancel Yes, and partially watched videos Due to ExoPlayer constraints the seek duration was set to %d seconds