[Android] Fix player options item background

Nicolas Pomepuy git at videolan.org
Wed Sep 4 15:39:06 CEST 2019


vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Sep  2 14:18:02 2019 +0200| [bea54abb0376506ce6c22f59705a63bc107c54b3] | committer: Nicolas Pomepuy

Fix player options item background

Fixes #1014

(cherry picked from commit 85fa57d48e246036d44d0a7c8646f16b262d8eaa)

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

 .../advanced_option_focusable_background.xml       |  5 +++
 vlc-android/res/layout/player_option_item.xml      | 42 ++++++++++++----------
 2 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/vlc-android/res/drawable/advanced_option_focusable_background.xml b/vlc-android/res/drawable/advanced_option_focusable_background.xml
new file mode 100644
index 000000000..c10c794ce
--- /dev/null
+++ b/vlc-android/res/drawable/advanced_option_focusable_background.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_focused="true" android:drawable="@color/orange500transparent" />
+    <item android:drawable="@color/transparent" />
+</selector>
\ No newline at end of file
diff --git a/vlc-android/res/layout/player_option_item.xml b/vlc-android/res/layout/player_option_item.xml
index 372507671..ba9eff517 100644
--- a/vlc-android/res/layout/player_option_item.xml
+++ b/vlc-android/res/layout/player_option_item.xml
@@ -1,36 +1,40 @@
 <?xml version="1.0" encoding="utf-8"?>
 <layout>
+
     <data>
+
         <variable
-            name="option"
-            type="org.videolan.vlc.gui.helpers.PlayerOption" />
+                name="option"
+                type="org.videolan.vlc.gui.helpers.PlayerOption" />
     </data>
+
     <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:app="http://schemas.android.com/apk/res-auto"
             android:layout_width="@dimen/player_option_width"
             android:layout_height="wrap_content"
+            android:background="@drawable/advanced_option_focusable_background"
             android:focusable="true"
             android:padding="8dp">
 
         <ImageView
-            android:id="@+id/option_icon"
-            android:layout_width="32dp"
-            android:layout_height="32dp"
-            android:layout_marginEnd="@dimen/default_margin"
-            app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toStartOf="@+id/option_title"/>
+                android:id="@+id/option_icon"
+                android:layout_width="32dp"
+                android:layout_height="32dp"
+                android:layout_marginEnd="@dimen/default_margin"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toStartOf="@+id/option_title"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent" />
 
         <TextView
-            android:id="@+id/option_title"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toEndOf="@+id/option_icon"
-            android:textAppearance="@style/VLC.CtxTitle"
-            android:text="@{option.title}" />
+                android:id="@+id/option_title"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:text="@{option.title}"
+                android:textAppearance="@style/VLC.CtxTitle"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toEndOf="@+id/option_icon"
+                app:layout_constraintTop_toTopOf="parent" />
     </androidx.constraintlayout.widget.ConstraintLayout>
 </layout>



More information about the Android mailing list