From 87febf8679e628bb93e30f96784d487fa7df14ae Mon Sep 17 00:00:00 2001 From: John Zhen Mo Date: Wed, 1 Nov 2017 22:33:13 -0700 Subject: [PATCH] -Added dropdown to start play for all StreamInfoItem. -Refactored NavigationHelper to allow service player control to open anywhere. -Refactored NavigationHelper to allow starting player at anywhere. --- .../fragments/detail/VideoDetailFragment.java | 30 +++--- .../fragments/list/BaseListFragment.java | 10 ++ .../list/playlist/PlaylistFragment.java | 11 +-- .../subscription/SubscriptionFragment.java | 4 + .../newpipe/info_list/InfoItemBuilder.java | 2 + .../holder/StreamMiniInfoItemHolder.java | 91 ++++++++++++++++++ .../newpipe/player/BackgroundPlayer.java | 13 +-- .../newpipe/player/PopupVideoPlayer.java | 11 +-- .../newpipe/playlist/SinglePlayQueue.java | 11 ++- .../schabi/newpipe/util/NavigationHelper.java | 48 ++++++++- .../drawable-hdpi/ic_more_vert_black_24dp.png | Bin 0 -> 132 bytes .../drawable-hdpi/ic_more_vert_white_24dp.png | Bin 0 -> 134 bytes .../drawable-mdpi/ic_more_vert_black_24dp.png | Bin 0 -> 108 bytes .../drawable-mdpi/ic_more_vert_white_24dp.png | Bin 0 -> 112 bytes .../ic_more_vert_black_24dp.png | Bin 0 -> 155 bytes .../ic_more_vert_white_24dp.png | Bin 0 -> 158 bytes .../ic_more_vert_black_24dp.png | Bin 0 -> 205 bytes .../ic_more_vert_white_24dp.png | Bin 0 -> 216 bytes .../ic_more_vert_black_24dp.png | Bin 0 -> 272 bytes .../ic_more_vert_white_24dp.png | Bin 0 -> 305 bytes app/src/main/res/layout/list_stream_item.xml | 29 +++++- .../main/res/layout/list_stream_mini_item.xml | 23 ++++- app/src/main/res/values/attrs.xml | 1 + app/src/main/res/values/strings.xml | 2 + app/src/main/res/values/styles.xml | 2 + 25 files changed, 240 insertions(+), 48 deletions(-) create mode 100644 app/src/main/res/drawable-hdpi/ic_more_vert_black_24dp.png create mode 100644 app/src/main/res/drawable-hdpi/ic_more_vert_white_24dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_more_vert_black_24dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_more_vert_white_24dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_more_vert_black_24dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_more_vert_white_24dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_more_vert_black_24dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_more_vert_white_24dp.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_more_vert_black_24dp.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_more_vert_white_24dp.png diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 63b7e9ace..265e22319 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -36,6 +36,7 @@ import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.PopupMenu; import android.widget.RelativeLayout; import android.widget.Spinner; import android.widget.TextView; @@ -459,6 +460,9 @@ public class VideoDetailFragment extends BaseStateFragment implement public void selected(StreamInfoItem selectedItem) { selectAndLoadVideo(selectedItem.service_id, selectedItem.url, selectedItem.name); } + + @Override + public void dropdownClicked(StreamInfoItem selectedItem, PopupMenu menu) {} }); videoTitleRoot.setOnClickListener(this); @@ -792,16 +796,12 @@ public class VideoDetailFragment extends BaseStateFragment implement ((HistoryListener) activity).onVideoPlayed(currentInfo, getSelectedVideoStream()); } - final PlayQueue playQueue = new SinglePlayQueue(currentInfo); - final Intent intent; + final PlayQueue itemQueue = new SinglePlayQueue(currentInfo); if (append) { - Toast.makeText(activity, R.string.popup_playing_append, Toast.LENGTH_SHORT).show(); - intent = NavigationHelper.getPlayerEnqueueIntent(activity, PopupVideoPlayer.class, playQueue); + NavigationHelper.enqueueOnPopupPlayer(activity, itemQueue); } else { - Toast.makeText(activity, R.string.popup_playing_toast, Toast.LENGTH_SHORT).show(); - intent = NavigationHelper.getPlayerIntent(activity, PopupVideoPlayer.class, playQueue, getSelectedVideoStream().resolution); + NavigationHelper.playOnPopupPlayer(activity, itemQueue); } - activity.startService(intent); } private void openVideoPlayer() { @@ -820,13 +820,11 @@ public class VideoDetailFragment extends BaseStateFragment implement private void openNormalBackgroundPlayer(final boolean append) { - final PlayQueue playQueue = new SinglePlayQueue(currentInfo); + final PlayQueue itemQueue = new SinglePlayQueue(currentInfo); if (append) { - activity.startService(NavigationHelper.getPlayerEnqueueIntent(activity, BackgroundPlayer.class, playQueue)); - Toast.makeText(activity, R.string.background_player_append, Toast.LENGTH_SHORT).show(); + NavigationHelper.enqueueOnBackgroundPlayer(activity, itemQueue); } else { - activity.startService(NavigationHelper.getPlayerIntent(activity, BackgroundPlayer.class, playQueue)); - Toast.makeText(activity, R.string.background_player_playing_toast, Toast.LENGTH_SHORT).show(); + NavigationHelper.playOnBackgroundPlayer(activity, itemQueue); } } @@ -865,22 +863,20 @@ public class VideoDetailFragment extends BaseStateFragment implement } private void openNormalPlayer(VideoStream selectedVideoStream) { - Intent mIntent; boolean useOldPlayer = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(getString(R.string.use_old_player_key), false) || (Build.VERSION.SDK_INT < 16); if (!useOldPlayer) { // ExoPlayer - final PlayQueue playQueue = new SinglePlayQueue(currentInfo); - mIntent = NavigationHelper.getPlayerIntent(activity, MainVideoPlayer.class, playQueue, getSelectedVideoStream().resolution); + NavigationHelper.playOnMainPlayer(activity, new SinglePlayQueue(currentInfo)); } else { // Internal Player - mIntent = new Intent(activity, PlayVideoActivity.class) + final Intent mIntent = new Intent(activity, PlayVideoActivity.class) .putExtra(PlayVideoActivity.VIDEO_TITLE, currentInfo.name) .putExtra(PlayVideoActivity.STREAM_URL, selectedVideoStream.url) .putExtra(PlayVideoActivity.VIDEO_URL, currentInfo.url) .putExtra(PlayVideoActivity.START_POSITION, currentInfo.start_position); + startActivity(mIntent); } - startActivity(mIntent); } private void openExternalVideoPlayer(VideoStream selectedVideoStream) { 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 35f6a08d3..e3a94a5e2 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 @@ -10,6 +10,7 @@ import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.View; +import android.widget.PopupMenu; import org.schabi.newpipe.R; import org.schabi.newpipe.extractor.InfoItem; @@ -139,6 +140,9 @@ public abstract class BaseListFragment extends BaseStateFragment implem useAsFrontPage?getParentFragment().getFragmentManager():getFragmentManager(), selectedItem.service_id, selectedItem.url, selectedItem.name); } + + @Override + public void dropdownClicked(StreamInfoItem selectedItem, PopupMenu menu) {} }); infoListAdapter.setOnChannelSelectedListener(new InfoItemBuilder.OnInfoItemSelectedListener() { @@ -149,6 +153,9 @@ public abstract class BaseListFragment extends BaseStateFragment implem useAsFrontPage?getParentFragment().getFragmentManager():getFragmentManager(), selectedItem.service_id, selectedItem.url, selectedItem.name); } + + @Override + public void dropdownClicked(ChannelInfoItem selectedItem, PopupMenu menu) {} }); infoListAdapter.setOnPlaylistSelectedListener(new InfoItemBuilder.OnInfoItemSelectedListener() { @@ -159,6 +166,9 @@ public abstract class BaseListFragment extends BaseStateFragment implem useAsFrontPage?getParentFragment().getFragmentManager():getFragmentManager(), selectedItem.service_id, selectedItem.url, selectedItem.name); } + + @Override + public void dropdownClicked(PlaylistInfoItem selectedItem, PopupMenu menu) {} }); itemsList.clearOnScrollListeners(); diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java index b88d54524..9d57617d3 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java @@ -160,7 +160,7 @@ public class PlaylistFragment extends BaseListInfoFragment { headerPlayAllButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - startActivity(buildPlaylistIntent(MainVideoPlayer.class)); + NavigationHelper.playOnMainPlayer(activity, getPlayQueue()); } }); headerPopupButton.setOnClickListener(new View.OnClickListener() { @@ -173,26 +173,25 @@ public class PlaylistFragment extends BaseListInfoFragment { toast.show(); return; } - activity.startService(buildPlaylistIntent(PopupVideoPlayer.class)); + NavigationHelper.playOnPopupPlayer(activity, getPlayQueue()); } }); headerBackgroundButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - activity.startService(buildPlaylistIntent(BackgroundPlayer.class)); + NavigationHelper.playOnBackgroundPlayer(activity, getPlayQueue()); } }); } - private Intent buildPlaylistIntent(final Class targetClazz) { - final PlayQueue playQueue = new ExternalPlayQueue( + private PlayQueue getPlayQueue() { + return new ExternalPlayQueue( currentInfo.service_id, currentInfo.url, currentInfo.next_streams_url, infoListAdapter.getItemsList(), 0 ); - return NavigationHelper.getPlayerIntent(activity, targetClazz, playQueue); } @Override diff --git a/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java index 520586663..c3afa9620 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java @@ -10,6 +10,7 @@ import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.PopupMenu; import org.schabi.newpipe.R; import org.schabi.newpipe.database.subscription.SubscriptionEntity; @@ -134,6 +135,9 @@ public class SubscriptionFragment extends BaseStateFragment { void selected(T selectedItem); + void dropdownClicked(T selectedItem, PopupMenu menu); } private final Context context; diff --git a/app/src/main/java/org/schabi/newpipe/info_list/holder/StreamMiniInfoItemHolder.java b/app/src/main/java/org/schabi/newpipe/info_list/holder/StreamMiniInfoItemHolder.java index 138503d39..1dea9633b 100644 --- a/app/src/main/java/org/schabi/newpipe/info_list/holder/StreamMiniInfoItemHolder.java +++ b/app/src/main/java/org/schabi/newpipe/info_list/holder/StreamMiniInfoItemHolder.java @@ -1,10 +1,16 @@ package org.schabi.newpipe.info_list.holder; +import android.content.Context; import android.support.v4.content.ContextCompat; +import android.view.Menu; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageButton; import android.widget.ImageView; +import android.widget.PopupMenu; import android.widget.TextView; +import android.widget.Toast; import com.nostra13.universalimageloader.core.DisplayImageOptions; @@ -13,7 +19,12 @@ import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.stream.StreamType; import org.schabi.newpipe.info_list.InfoItemBuilder; +import org.schabi.newpipe.player.BackgroundPlayer; +import org.schabi.newpipe.player.PopupVideoPlayer; +import org.schabi.newpipe.playlist.PlayQueue; +import org.schabi.newpipe.playlist.SinglePlayQueue; import org.schabi.newpipe.util.Localization; +import org.schabi.newpipe.util.NavigationHelper; public class StreamMiniInfoItemHolder extends InfoItemHolder { @@ -21,6 +32,7 @@ public class StreamMiniInfoItemHolder extends InfoItemHolder { public final TextView itemVideoTitleView; public final TextView itemUploaderView; public final TextView itemDurationView; + public final ImageButton itemActionDropdown; StreamMiniInfoItemHolder(InfoItemBuilder infoItemBuilder, int layoutId, ViewGroup parent) { super(infoItemBuilder, layoutId, parent); @@ -29,6 +41,7 @@ public class StreamMiniInfoItemHolder extends InfoItemHolder { itemVideoTitleView = itemView.findViewById(R.id.itemVideoTitleView); itemUploaderView = itemView.findViewById(R.id.itemUploaderView); itemDurationView = itemView.findViewById(R.id.itemDurationView); + itemActionDropdown = itemView.findViewById(R.id.itemActionDropdown); } public StreamMiniInfoItemHolder(InfoItemBuilder infoItemBuilder, ViewGroup parent) { @@ -67,6 +80,84 @@ public class StreamMiniInfoItemHolder extends InfoItemHolder { } } }); + + switch (item.stream_type) { + case AUDIO_STREAM: + case VIDEO_STREAM: + case FILE: + enableActionDropdown(item); + break; + case LIVE_STREAM: + case AUDIO_LIVE_STREAM: + case NONE: + default: + break; + } + } + + private void enableActionDropdown(final StreamInfoItem item) { + itemActionDropdown.setVisibility(View.VISIBLE); + itemActionDropdown.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + final PopupMenu actionMenu = getStreamDropdown(itemBuilder.getContext(), itemActionDropdown, item); + if (itemBuilder.getOnStreamSelectedListener() != null) { + itemBuilder.getOnStreamSelectedListener().dropdownClicked(item, actionMenu); + } + actionMenu.show(); + } + }); + } + + private PopupMenu getStreamDropdown(final Context context, final View anchor, final StreamInfoItem infoItem) { + PopupMenu actionMenu = new PopupMenu(context, anchor); + + final MenuItem mainPlay = actionMenu.getMenu().add(R.string.play_btn_text); + mainPlay.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem menuItem) { + NavigationHelper.playOnMainPlayer(context, new SinglePlayQueue(infoItem)); + return true; + } + }); + + final MenuItem popupPlay = actionMenu.getMenu().add(R.string.controls_popup_title); + popupPlay.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem menuItem) { + NavigationHelper.playOnPopupPlayer(context, new SinglePlayQueue(infoItem)); + return true; + } + }); + + final MenuItem backgroundPlay = actionMenu.getMenu().add(R.string.controls_background_title); + backgroundPlay.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem menuItem) { + NavigationHelper.playOnBackgroundPlayer(context, new SinglePlayQueue(infoItem)); + return true; + } + }); + + final MenuItem backgroundEnqueue = actionMenu.getMenu().add(R.string.enqueue_on_background); + backgroundEnqueue.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem menuItem) { + NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(infoItem)); + return true; + } + }); + + final MenuItem popupEnqueue = actionMenu.getMenu().add(R.string.enqueue_on_popup); + popupEnqueue.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem menuItem) { + NavigationHelper.enqueueOnPopupPlayer(context, new SinglePlayQueue(infoItem)); + return true; + } + }); + + return actionMenu; } /** diff --git a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java index 25735330d..cfed78179 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java @@ -48,6 +48,7 @@ import org.schabi.newpipe.player.event.PlayerEventListener; import org.schabi.newpipe.player.helper.LockManager; import org.schabi.newpipe.playlist.PlayQueueItem; import org.schabi.newpipe.util.ListHelper; +import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.ThemeHelper; import static org.schabi.newpipe.player.helper.PlayerHelper.getTimeString; @@ -130,16 +131,6 @@ public final class BackgroundPlayer extends Service { /*////////////////////////////////////////////////////////////////////////// // Actions //////////////////////////////////////////////////////////////////////////*/ - - public void openControl(final Context context) { - Intent intent = new Intent(context, BackgroundPlayerActivity.class); - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - } - context.startActivity(intent); - context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); - } - private void onClose() { if (DEBUG) Log.d(TAG, "onClose() called"); @@ -470,7 +461,7 @@ public final class BackgroundPlayer extends Service { onVideoPlayPause(); break; case ACTION_OPEN_CONTROLS: - openControl(getApplicationContext()); + NavigationHelper.openBackgroundPlayerControl(getApplicationContext()); break; case ACTION_REPEAT: onRepeatClicked(); diff --git a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java index 71068dbea..babbdbff5 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java @@ -318,15 +318,6 @@ public final class PopupVideoPlayer extends Service { stopSelf(); } - public void openControl(final Context context) { - Intent intent = new Intent(context, PopupVideoPlayerActivity.class); - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - } - context.startActivity(intent); - context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); - } - /*////////////////////////////////////////////////////////////////////////// // Utils //////////////////////////////////////////////////////////////////////////*/ @@ -622,7 +613,7 @@ public final class PopupVideoPlayer extends Service { onVideoPlayPause(); break; case ACTION_OPEN_CONTROLS: - openControl(getApplicationContext()); + NavigationHelper.openPopupPlayerControl(getApplicationContext()); break; case ACTION_REPEAT: onRepeatClicked(); diff --git a/app/src/main/java/org/schabi/newpipe/playlist/SinglePlayQueue.java b/app/src/main/java/org/schabi/newpipe/playlist/SinglePlayQueue.java index fc68e931a..ae74528eb 100644 --- a/app/src/main/java/org/schabi/newpipe/playlist/SinglePlayQueue.java +++ b/app/src/main/java/org/schabi/newpipe/playlist/SinglePlayQueue.java @@ -1,12 +1,21 @@ package org.schabi.newpipe.playlist; import org.schabi.newpipe.extractor.stream.StreamInfo; +import org.schabi.newpipe.extractor.stream.StreamInfoItem; import java.util.Collections; public final class SinglePlayQueue extends PlayQueue { + public SinglePlayQueue(final StreamInfoItem item) { + this(new PlayQueueItem(item)); + } + public SinglePlayQueue(final StreamInfo info) { - super(0, Collections.singletonList(new PlayQueueItem(info))); + this(new PlayQueueItem(info)); + } + + private SinglePlayQueue(final PlayQueueItem playQueueItem) { + super(0, Collections.singletonList(playQueueItem)); } @Override diff --git a/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java b/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java index a68494706..07fc4ba7b 100644 --- a/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java @@ -5,10 +5,11 @@ import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.net.Uri; +import android.os.Build; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; -import android.support.v7.app.AppCompatActivity; +import android.widget.Toast; import com.nostra13.universalimageloader.core.ImageLoader; @@ -28,7 +29,12 @@ import org.schabi.newpipe.fragments.list.kiosk.KioskFragment; import org.schabi.newpipe.fragments.list.playlist.PlaylistFragment; import org.schabi.newpipe.fragments.list.search.SearchFragment; import org.schabi.newpipe.history.HistoryActivity; +import org.schabi.newpipe.player.BackgroundPlayer; +import org.schabi.newpipe.player.BackgroundPlayerActivity; import org.schabi.newpipe.player.BasePlayer; +import org.schabi.newpipe.player.MainVideoPlayer; +import org.schabi.newpipe.player.PopupVideoPlayer; +import org.schabi.newpipe.player.PopupVideoPlayerActivity; import org.schabi.newpipe.player.VideoPlayer; import org.schabi.newpipe.playlist.PlayQueue; import org.schabi.newpipe.settings.SettingsActivity; @@ -77,6 +83,29 @@ public class NavigationHelper { .putExtra(BasePlayer.PLAYBACK_PITCH, playbackPitch); } + public static void playOnMainPlayer(final Context context, final PlayQueue queue) { + context.startActivity(getPlayerIntent(context, MainVideoPlayer.class, queue)); + } + + public static void playOnPopupPlayer(final Context context, final PlayQueue queue) { + Toast.makeText(context, R.string.popup_playing_toast, Toast.LENGTH_SHORT).show(); + context.startService(getPlayerIntent(context, PopupVideoPlayer.class, queue)); + } + + public static void playOnBackgroundPlayer(final Context context, final PlayQueue queue) { + Toast.makeText(context, R.string.background_player_playing_toast, Toast.LENGTH_SHORT).show(); + context.startService(getPlayerIntent(context, BackgroundPlayer.class, queue)); + } + + public static void enqueueOnPopupPlayer(final Context context, final PlayQueue queue) { + Toast.makeText(context, R.string.popup_playing_append, Toast.LENGTH_SHORT).show(); + context.startService(getPlayerEnqueueIntent(context, PopupVideoPlayer.class, queue)); + } + + public static void enqueueOnBackgroundPlayer(final Context context, final PlayQueue queue) { + Toast.makeText(context, R.string.background_player_append, Toast.LENGTH_SHORT).show(); + context.startService(getPlayerEnqueueIntent(context, BackgroundPlayer.class, queue)); + } /*////////////////////////////////////////////////////////////////////////// // Through FragmentManager //////////////////////////////////////////////////////////////////////////*/ @@ -230,6 +259,23 @@ public class NavigationHelper { return true; } + public static void openBackgroundPlayerControl(final Context context) { + openServicePlayerControl(context, BackgroundPlayerActivity.class); + } + + public static void openPopupPlayerControl(final Context context) { + openServicePlayerControl(context, PopupVideoPlayerActivity.class); + } + + private static void openServicePlayerControl(final Context context, final Class clazz) { + final Intent intent = new Intent(context, clazz); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + } + context.startActivity(intent); + context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); + } + /*////////////////////////////////////////////////////////////////////////// // Link handling //////////////////////////////////////////////////////////////////////////*/ diff --git a/app/src/main/res/drawable-hdpi/ic_more_vert_black_24dp.png b/app/src/main/res/drawable-hdpi/ic_more_vert_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..22acc550088d98f9d98ced517de75b5e8ead3c7c GIT binary patch literal 132 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B5}8r;B4q1>@UGdwClSM3^70uIQ21 z47_&cJkx~*+Z%R2IKOxGVZM^fH+7^Mmwc{S?NKJ@tD@b{HffqWt7pJW9xm}`3bIR@ eOD6DrGLJi>8B(9~m^Tk-EQ6=3pUXO@geCy;;w$k0 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_more_vert_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_more_vert_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..67f07e473442d1f5bd5dc486a42ce4bedf40b425 GIT binary patch literal 134 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8K;ucwP+h{y4_mv-_VP!M4WR9aA@ zB9L2TV$k7bqBi~Tf{Y7K)@EPe&B(sMnUQ&cV?}1b!p)H;o34MJ iAa}{R%7g#se7OLo1Hz}Zd6xqXX7F_Nb6Mw<&;$T!hAw^p literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_more_vert_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_more_vert_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..0e4f2f6ea0564fe9d6ebdb4bea0df48aced9de0f GIT binary patch literal 108 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_*1V^0^ykP60RiERoU4^0niv(+!U z$~^Ty`=RMavMX4xeQ2uS{l}xxJ=eVCD820|N5W*kJjJ67$C*FG*QAUgq7iWp7Wo)^m*JsBN#kg L{an^LB{Ts5on9xv literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_more_vert_black_24dp.png b/app/src/main/res/drawable-xhdpi/ic_more_vert_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..9f10aa2759a2e53beb129849c9b0e6ee5f7ae97b GIT binary patch literal 155 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}b0DBu^K|kP61PR}A@_6b0BGTJ|c& z&2zArUdgs%qoJD@@9neO|NgtXV7^DW)MQ81qkHN%-79zXF}ZeKv~Tuphvz#4Z3DJ9 zo+<2n{rTU)UWQJm<&*zc>PM$^=S_g|6%VwoI2{_d>%srJ7&|&vk-TbVh<5S;l;%8hhyk$Kc9U$ho zN!;a@as7tMKN^!>mP|UmC!qU^(pC>$p{$8fOT;)oR_iUC=UG0_`?VR+LIzJ)KbLh* G2~7aOZ8w1c literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_more_vert_black_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_more_vert_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..94d5ab98c6d3b3548536f04a2d635fb5c4a05b88 GIT binary patch literal 205 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY0wn)GsXhawrg*wIhEy=Vy=KqV>>$DV@#Ph3 zmm-(IJxlAmHdKggydBZHA?LrN(f;zraK2yFla}<&ocsFTF&FO*>g+$WJLfsbvhR#o zqU5?6`INL2k&sND<*?!p=%CFlpb5%Rrp)D#!8^w7WtAYxjJ8qaZaq8!Lha3*C xpO9i0)g!jJUB|8aV$u`{=V%64OvRJ&URzP%pP$_?yn*gx@O1TaS?83{1OO~yQ~m$| literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_more_vert_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_more_vert_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..d32281307232fefc363e19d9d2728af62b440a8d GIT binary patch literal 216 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY0wn)GsXhaw=6kw0hGg7(d(E5ckb#KX!!teA z8+IJIbSd_mp~lgrEob_e9cxnR1kZ18I^5b~uj)DJpG>-%nby>)6J_QWKRvd(S?`Ri~_DWys(>8rgyQv zG%aCaz>Js9>y=L)eUVgRxJx3oN6$@sv5NTO?u&4dNh*K$SbOB%sZae;9uIUXgQu&X J%Q~loCIECSTxI|O literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_more_vert_black_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_more_vert_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..4642a3b66e690a25544c7a65b5484607c76e9e4d GIT binary patch literal 272 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD0wg^q?%xcgu6w#ThEy=Vz2TVE>>%O(aeKF| z&%}AAoaYX07I~@2Qzf){=E~b*b6q_X?JD-aXZn{o>8SH070*d=@0yRCD&F7PI4|Iy zgr>dT{)s<*uuMbP?bJzL!+Uj>du1MOpP(^y_vJlXtsXdjo_CdTHuJx`L9zyy z_bjw};Pttx=xP2JS*8CI?{O?lw)*qOUytSD#5&t0XL`98ez{Y*;jMY`-`}^VtDMwJ z5#Pjpv-OQrnIiiQFtvL^tj8o3AbA2TH#1Zw0j|Uo=)7NS4apHKER!-ifL>(qboFyt I=akR{05Df}#Q*>R literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_more_vert_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_more_vert_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..2f2cb3d004f6e828917b5f6b1decc7fe5d99b445 GIT binary patch literal 305 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD0wg^q?%xcget5b#hE&{od&7{g$w9>R;>#mP zB_2gJIy{WxDHIfl;54zZ?(Dj(@bmNJ>M(=pX9D&J05vf@IA0RFIB;_s@2aW4t^P!s z?~T5q@wxa<`?f89Li_gpTlKB*dwsOb9#+$?m6!M>7BklVVk|aEPh1DJ$>V{EJl=XH?V({#-awY-(QL|0?dORlc*XtSl(} z&d3n4k$a}x{MZxU-fiZ-$+m%8aD#C}>V?${Gwe!OwoRt{8X v))3p#FqiR-(={Oe2E;4(u$C!;+}~cs6m#}#(>L)Q#vrbztDnm{r-UW|mL!4d literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/list_stream_item.xml b/app/src/main/res/layout/list_stream_item.xml index cb1ac6fe2..f09ab89be 100644 --- a/app/src/main/res/layout/list_stream_item.xml +++ b/app/src/main/res/layout/list_stream_item.xml @@ -7,7 +7,9 @@ android:layout_height="@dimen/video_item_search_height" android:background="?attr/selectableItemBackground" android:clickable="true" - android:padding="@dimen/video_item_search_padding"> + android:focusable="true" + android:paddingTop="@dimen/video_item_search_padding" + android:paddingBottom="@dimen/video_item_search_padding"> + + + android:focusable="true" + android:paddingTop="@dimen/video_item_search_padding" + android:paddingBottom="@dimen/video_item_search_padding"> + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7092feaf5..1d93b61f1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -310,4 +310,6 @@ Details Audio Settings Hold To Enqueue + Enqueue on Background + Enqueue on Popup diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 8f0bb02cd..85549c8c5 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -27,6 +27,7 @@ @drawable/ic_history_black_24dp @drawable/ic_drag_handle_black_24dp @drawable/ic_fiber_manual_record_black_24dp + @drawable/ic_more_vert_black_24dp @color/light_separator_color @color/light_contrast_background_color @@ -65,6 +66,7 @@ @drawable/ic_history_white_24dp @drawable/ic_drag_handle_white_24dp @drawable/ic_fiber_manual_record_white_24dp + @drawable/ic_more_vert_white_24dp @color/dark_separator_color @color/dark_contrast_background_color