[Android] Fix equalizer focus issue

Nicolas Pomepuy git at videolan.org
Fri Aug 23 09:20:08 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Thu Aug 22 15:03:15 2019 +0200| [5f01912d9c7681afe9876739c40d7011ffef2f88] | committer: Nicolas Pomepuy

Fix equalizer focus issue

> https://code.videolan.org/videolan/vlc-android/commit/5f01912d9c7681afe9876739c40d7011ffef2f88
---

 vlc-android/res/layout/equalizer.xml                           | 10 ++++++++--
 .../src/org/videolan/vlc/gui/audio/EqualizerFragment.kt        |  3 +--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/vlc-android/res/layout/equalizer.xml b/vlc-android/res/layout/equalizer.xml
index 580333a97..e3f9ea990 100644
--- a/vlc-android/res/layout/equalizer.xml
+++ b/vlc-android/res/layout/equalizer.xml
@@ -15,7 +15,12 @@
 
         <androidx.constraintlayout.widget.ConstraintLayout
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content">
+                android:layout_height="wrap_content"
+                android:id="@+id/equalizer_container"
+                android:nextFocusDown="@+id/equalizer_button"
+                android:nextFocusForward="@+id/equalizer_button"
+                android:nextFocusLeft="@+id/equalizer_button"
+                android:nextFocusRight="@+id/equalizer_button">
 
             <TextView
                     android:id="@+id/eq_title"
@@ -39,6 +44,7 @@
                     android:layout_marginEnd="16dp"
                     android:layout_marginBottom="8dp"
                     app:switchPadding="8dp"
+                    android:focusableInTouchMode="false"
                     android:text="@string/enable_equalizer"
                     app:layout_constraintBottom_toTopOf="@+id/equalizer_presets"
                     app:layout_constraintEnd_toEndOf="parent"
@@ -56,7 +62,7 @@
                     app:layout_constraintTop_toBottomOf="@+id/eq_title"
                     >
 
-                <requestFocus/>
+
             </androidx.appcompat.widget.AppCompatSpinner>
 
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt b/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt
index 970a5aa8e..da9f08cbc 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt
@@ -57,7 +57,7 @@ class EqualizerFragment : VLCBottomSheetDialogFragment() {
 
     override fun needToManageOrientation() = false
 
-    override fun initialFocusedView() = binding.equalizerButton
+    override fun initialFocusedView(): View = binding.equalizerContainer
 
     private lateinit var equalizer: MediaPlayer.Equalizer
     private var customCount = 0
@@ -128,7 +128,6 @@ class EqualizerFragment : VLCBottomSheetDialogFragment() {
             v.parent.requestDisallowInterceptTouchEvent(true)
             true
         }
-        binding.equalizerButton.clearFocus()
     }
 
     private fun fillViews() {



More information about the Android mailing list