From a0bbcd2fee8b678516aa57db8689d4711e0ab70a Mon Sep 17 00:00:00 2001 From: Stypox Date: Sun, 27 Feb 2022 15:25:08 +0100 Subject: [PATCH 1/3] Fix player queue/segments list buttons not focusable with DPAD Now the in-player play queue and the segments list are closeable --- app/src/main/java/org/schabi/newpipe/player/Player.java | 3 +++ app/src/main/res/layout/player.xml | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 85a50cb23..97c06dce9 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -3215,6 +3215,9 @@ public final class Player implements binding.itemsListPanel.setTranslationY( -binding.itemsListPanel.getHeight() * 5); }); + + // clear focus, otherwise a white rectangle remains on top of the player + binding.itemsListClose.clearFocus(); binding.playPauseButton.requestFocus(); } } diff --git a/app/src/main/res/layout/player.xml b/app/src/main/res/layout/player.xml index 1fc769c18..839b98680 100644 --- a/app/src/main/res/layout/player.xml +++ b/app/src/main/res/layout/player.xml @@ -545,9 +545,7 @@ + android:layout_height="60dp"> Date: Sun, 27 Feb 2022 15:26:33 +0100 Subject: [PATCH 2/3] Fix controls shown below queue/segments list when using DPAD Also invert if --- .../java/org/schabi/newpipe/player/Player.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 97c06dce9..6e11400ac 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -3815,8 +3815,9 @@ public final class Player implements case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_DPAD_RIGHT: case KeyEvent.KEYCODE_DPAD_CENTER: - if (binding.getRoot().hasFocus() && !binding.playbackControlRoot.hasFocus()) { - // do not interfere with focus in playlist etc. + if ((binding.getRoot().hasFocus() && !binding.playbackControlRoot.hasFocus()) + || isQueueVisible) { + // do not interfere with focus in playlist and play queue etc. return false; } @@ -3824,15 +3825,13 @@ public final class Player implements return true; } - if (!isControlsVisible()) { - if (!isQueueVisible) { - binding.playPauseButton.requestFocus(); - } + if (isControlsVisible()) { + hideControls(DEFAULT_CONTROLS_DURATION, DPAD_CONTROLS_HIDE_TIME); + } else { + binding.playPauseButton.requestFocus(); showControlsThenHide(); showSystemUIPartially(); return true; - } else { - hideControls(DEFAULT_CONTROLS_DURATION, DPAD_CONTROLS_HIDE_TIME); } break; } From 146062d9213df4f07a3203962299bba041d2cd03 Mon Sep 17 00:00:00 2001 From: Stypox Date: Sun, 27 Feb 2022 18:45:24 +0100 Subject: [PATCH 3/3] Fix player pop-ups not giving feedback on touch/focus --- app/src/main/java/org/schabi/newpipe/player/Player.java | 4 ++-- app/src/main/res/values/styles_misc.xml | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 6e11400ac..61083aa0a 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -73,7 +73,6 @@ import android.provider.Settings; import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; -import android.view.ContextThemeWrapper; import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -89,7 +88,6 @@ import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.PopupMenu; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.SeekBar; @@ -99,7 +97,9 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.content.res.AppCompatResources; +import androidx.appcompat.view.ContextThemeWrapper; import androidx.appcompat.widget.AppCompatImageButton; +import androidx.appcompat.widget.PopupMenu; import androidx.core.content.ContextCompat; import androidx.core.graphics.Insets; import androidx.core.view.GestureDetectorCompat; diff --git a/app/src/main/res/values/styles_misc.xml b/app/src/main/res/values/styles_misc.xml index 33f3a48ee..f539eb5a1 100644 --- a/app/src/main/res/values/styles_misc.xml +++ b/app/src/main/res/values/styles_misc.xml @@ -66,10 +66,7 @@ ?attr/actionColor - +