From 268762166af3a74fe4a9f9d53fa89f0729c5591c Mon Sep 17 00:00:00 2001 From: John Zhen Mo Date: Tue, 30 Jan 2018 19:39:41 -0800 Subject: [PATCH] -Added save on exit to local playlist fragment. -Improved drag reordering experience by setting minimum velocity. -Increased save debounce to 10 seconds. --- .../local/LocalPlaylistFragment.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/local/LocalPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/local/LocalPlaylistFragment.java index 0a6f9158e..e84ee41ff 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/local/LocalPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/local/LocalPlaylistFragment.java @@ -47,7 +47,9 @@ import static org.schabi.newpipe.util.AnimationUtils.animateView; public class LocalPlaylistFragment extends BaseLocalListFragment, Void> { - private static final long SAVE_DEBOUNCE_MILLIS = 2000; + // Save the list 10 seconds after the last change occurred + private static final long SAVE_DEBOUNCE_MILLIS = 10000; + private static final int MINIMUM_INITIAL_DRAG_VELOCITY = 15; private View headerRootLayout; private TextView headerTitleView; @@ -205,6 +207,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment saveJoin()); + .subscribe(ignored -> saveImmediate()); } - private void saveJoin() { + private void saveImmediate() { final List items = itemListAdapter.getItemsList(); List streamIds = new ArrayList<>(items.size()); for (final LocalItem item : items) { @@ -449,6 +452,17 @@ public class LocalPlaylistFragment extends BaseLocalListFragment