From 9db0133a5bdc32b5ad9a1f5abfce1b04417d8184 Mon Sep 17 00:00:00 2001 From: HybridAU Date: Wed, 14 Sep 2022 21:00:44 +0800 Subject: [PATCH] Add play queue button to video details fragment * Add play queue button to video details fragment * Use existing ic_list icon * Still open play queue even when queue is empty * Change app:srcCompat to android:src --- .../newpipe/fragments/detail/VideoDetailFragment.java | 5 +++++ .../org/schabi/newpipe/player/PlayQueueActivity.java | 1 - .../java/org/schabi/newpipe/util/NavigationHelper.java | 5 +++++ .../res/layout-large-land/fragment_video_detail.xml | 10 ++++++++++ app/src/main/res/layout/fragment_video_detail.xml | 10 ++++++++++ 5 files changed, 30 insertions(+), 1 deletion(-) 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 09e085791..bf84c7325 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 @@ -526,6 +526,9 @@ public final class VideoDetailFragment case R.id.overlay_buttons_layout: bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); break; + case R.id.overlay_play_queue_button: + NavigationHelper.openPlayQueue(getContext()); + break; case R.id.overlay_play_pause_button: if (playerIsNotStopped()) { player.playPause(); @@ -684,6 +687,7 @@ public final class VideoDetailFragment binding.overlayMetadataLayout.setOnClickListener(this); binding.overlayMetadataLayout.setOnLongClickListener(this); binding.overlayButtonsLayout.setOnClickListener(this); + binding.overlayPlayQueueButton.setOnClickListener(this); binding.overlayCloseButton.setOnClickListener(this); binding.overlayPlayPauseButton.setOnClickListener(this); @@ -2426,6 +2430,7 @@ public final class VideoDetailFragment binding.overlayMetadataLayout.setClickable(enable); binding.overlayMetadataLayout.setLongClickable(enable); binding.overlayButtonsLayout.setClickable(enable); + binding.overlayPlayQueueButton.setClickable(enable); binding.overlayPlayPauseButton.setClickable(enable); binding.overlayCloseButton.setClickable(enable); } diff --git a/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java b/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java index c18a7f487..94de7fef3 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java @@ -212,7 +212,6 @@ public final class PlayQueueActivity extends AppCompatActivity if (player == null || player.getPlayQueue() == null || player.exoPlayerIsNull()) { unbind(); - finish(); } else { onQueueUpdate(player.getPlayQueue()); buildComponents(); 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 3b2c52691..13413e89d 100644 --- a/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java @@ -639,6 +639,11 @@ public final class NavigationHelper { return intent; } + public static void openPlayQueue(final Context context) { + final Intent intent = new Intent(context, PlayQueueActivity.class); + context.startActivity(intent); + } + /*////////////////////////////////////////////////////////////////////////// // Link handling //////////////////////////////////////////////////////////////////////////*/ diff --git a/app/src/main/res/layout-large-land/fragment_video_detail.xml b/app/src/main/res/layout-large-land/fragment_video_detail.xml index 5904724ad..a29fa8c78 100644 --- a/app/src/main/res/layout-large-land/fragment_video_detail.xml +++ b/app/src/main/res/layout-large-land/fragment_video_detail.xml @@ -698,6 +698,16 @@ android:paddingRight="@dimen/video_item_search_padding" tools:ignore="RtlHardcoded"> + + + +