From 53a1833e26e949e3ec541f40a549c3b8ca3d3247 Mon Sep 17 00:00:00 2001 From: John Zhen Mo Date: Tue, 30 Jan 2018 18:17:27 -0800 Subject: [PATCH] -Increased save join debounce time to 2 seconds. -Added add to playlist option for videos available as base list items. -Moved video count to second row on local playlist header. -Removed bottom line on playlist control UI. --- .../fragments/list/BaseListFragment.java | 33 ++-- .../local/LocalPlaylistFragment.java | 2 +- .../main/res/layout/local_playlist_header.xml | 17 +- app/src/main/res/layout/playlist_control.xml | 157 ++++++++---------- 4 files changed, 100 insertions(+), 109 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/BaseListFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/BaseListFragment.java index aad6e95fa..8bc68a4c7 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/BaseListFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/BaseListFragment.java @@ -29,6 +29,7 @@ import org.schabi.newpipe.util.OnClickGesture; import org.schabi.newpipe.util.StateSaver; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Queue; @@ -194,22 +195,26 @@ public abstract class BaseListFragment extends BaseStateFragment implem final String[] commands = new String[]{ context.getResources().getString(R.string.enqueue_on_background), - context.getResources().getString(R.string.enqueue_on_popup) + context.getResources().getString(R.string.enqueue_on_popup), + context.getResources().getString(R.string.append_playlist) }; - final DialogInterface.OnClickListener actions = new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) { - switch (i) { - case 0: - NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(item)); - break; - case 1: - NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(item)); - break; - default: - break; - } + final DialogInterface.OnClickListener actions = (dialogInterface, i) -> { + switch (i) { + case 0: + NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(item)); + break; + case 1: + NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(item)); + break; + case 2: + if (getFragmentManager() != null) { + PlaylistAppendDialog.fromStreamInfoItems(Collections.singletonList(item)) + .show(getFragmentManager(), TAG); + } + break; + default: + break; } }; 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 7d73b14b9..0a6f9158e 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,7 @@ import static org.schabi.newpipe.util.AnimationUtils.animateView; public class LocalPlaylistFragment extends BaseLocalListFragment, Void> { - private static final long SAVE_DEBOUNCE_MILLIS = 1000; + private static final long SAVE_DEBOUNCE_MILLIS = 2000; private View headerRootLayout; private TextView headerTitleView; diff --git a/app/src/main/res/layout/local_playlist_header.xml b/app/src/main/res/layout/local_playlist_header.xml index 4d686c515..ab5dd4440 100644 --- a/app/src/main/res/layout/local_playlist_header.xml +++ b/app/src/main/res/layout/local_playlist_header.xml @@ -5,20 +5,17 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" + android:padding="6dp" android:background="?attr/contrast_background_color"> - - - - - - - - - - - - - - - - + android:layout_height="@dimen/playlist_ctrl_height" + android:layout_weight="1" + android:gravity="center" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + - + + - + android:layout_height="match_parent" + android:layout_weight="1" + android:gravity="center" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" + android:id="@+id/playlist_ctrl_play_all_button"> + + + + + + + + +