[Android] Fix advanced options focus and background

Nicolas Pomepuy git at videolan.org
Tue Aug 20 09:03:15 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Tue Aug 20 08:41:38 2019 +0200| [db9a5d09e2a5545b4ad7ccac48129429e61ff935] | committer: Nicolas Pomepuy

Fix advanced options focus and background

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

 vlc-android/res/drawable/rounded_corners.xml             |  4 +++-
 vlc-android/res/drawable/rounded_corners_light.xml       |  3 ++-
 vlc-android/res/layout/fragment_advanced_options.xml     |  7 -------
 vlc-android/res/layout/player_option_item.xml            | 10 +++++-----
 vlc-android/res/layout/player_options.xml                | 16 ++++++++--------
 vlc-android/res/values/attrs.xml                         |  2 +-
 vlc-android/res/values/styles.xml                        |  6 +++---
 .../videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt    |  4 ----
 8 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/vlc-android/res/drawable/rounded_corners.xml b/vlc-android/res/drawable/rounded_corners.xml
index a1e453a13..4e264e721 100644
--- a/vlc-android/res/drawable/rounded_corners.xml
+++ b/vlc-android/res/drawable/rounded_corners.xml
@@ -4,7 +4,9 @@
     android:shape="rectangle">
     <solid android:color="@color/playerbackground">
     </solid>
-    <corners android:radius="5dp">
+    <corners
+            android:topLeftRadius="4dp"
+            android:bottomLeftRadius="4dp">
     </corners>
 
 </shape>
\ No newline at end of file
diff --git a/vlc-android/res/drawable/rounded_corners_light.xml b/vlc-android/res/drawable/rounded_corners_light.xml
index 7fd4505fb..875493df9 100644
--- a/vlc-android/res/drawable/rounded_corners_light.xml
+++ b/vlc-android/res/drawable/rounded_corners_light.xml
@@ -6,7 +6,8 @@
         android:color="@color/whitetransparent" >
     </solid>
     <corners
-        android:radius="3dp"   >
+            android:topLeftRadius="4dp"
+            android:bottomLeftRadius="4dp">
     </corners>
 
 </shape>
\ No newline at end of file
diff --git a/vlc-android/res/layout/fragment_advanced_options.xml b/vlc-android/res/layout/fragment_advanced_options.xml
deleted file mode 100644
index 07c158ccc..000000000
--- a/vlc-android/res/layout/fragment_advanced_options.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<org.videolan.vlc.gui.view.AutoFitRecyclerView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:padding="@dimen/adv_options_margin"
-    android:background="?attr/rounded_bg"/>
diff --git a/vlc-android/res/layout/player_option_item.xml b/vlc-android/res/layout/player_option_item.xml
index 867758cde..c36f2bc71 100644
--- a/vlc-android/res/layout/player_option_item.xml
+++ b/vlc-android/res/layout/player_option_item.xml
@@ -6,11 +6,11 @@
             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:focusable="true"
-        android:layout_margin="6dp">
+                                                       xmlns:app="http://schemas.android.com/apk/res-auto"
+                                                       android:layout_width="@dimen/player_option_width"
+                                                       android:layout_height="wrap_content"
+                                                       android:focusable="true"
+                                                       android:padding="8dp">
 
         <ImageView
             android:id="@+id/option_icon"
diff --git a/vlc-android/res/layout/player_options.xml b/vlc-android/res/layout/player_options.xml
index f1d08ad8a..2eb918135 100644
--- a/vlc-android/res/layout/player_options.xml
+++ b/vlc-android/res/layout/player_options.xml
@@ -7,12 +7,12 @@
     android:focusable="false">
 
     <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/options_list"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center|end"
-        android:background="?attr/rounded_bg"
-        android:clipToPadding="false"
-        android:paddingTop="@dimen/default_margin"
-        android:paddingBottom="@dimen/default_margin" />
+            android:id="@+id/options_list"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center|end"
+            android:background="?attr/advanced_options_bg"
+            android:clipToPadding="false"
+            android:paddingTop="@dimen/default_margin"
+            android:paddingBottom="@dimen/default_margin" />
 </FrameLayout>
diff --git a/vlc-android/res/values/attrs.xml b/vlc-android/res/values/attrs.xml
index 9edfb7644..e28439afe 100644
--- a/vlc-android/res/values/attrs.xml
+++ b/vlc-android/res/values/attrs.xml
@@ -78,7 +78,7 @@
     <attr name="shadow_bottom_9patch" format="reference"/>
 
     <attr name="advanced_options_style" format="reference" />
-    <attr name="rounded_bg" format="reference" />
+    <attr name="advanced_options_bg" format="reference"/>
 
     <declare-styleable name="SlidingPaneLayout">
         <attr name="overhangSize" format="dimension" />
diff --git a/vlc-android/res/values/styles.xml b/vlc-android/res/values/styles.xml
index 0be6e15cd..34316f214 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -71,7 +71,7 @@
         <item name="gridview_progressbar">@drawable/gridview_progressbar</item>
         <item name="progress_mini_player">@drawable/progress_mini_player</item>
         <item name="advanced_options_style">@style/Theme.MaterialComponents.Light.Dialog</item>
-        <item name="rounded_bg">@drawable/rounded_corners_light</item>
+        <item name="advanced_options_bg">@drawable/rounded_corners_light</item>
         <item name="ic_playasaudio_off">@drawable/ic_playasaudio_off</item>
         <item name="ic_playasaudio_on">@drawable/ic_playasaudio_on</item>
         <item name="ic_popup_expand">@drawable/ic_popup_expand</item>
@@ -182,7 +182,7 @@
         <item name="gridview_progressbar">@drawable/gridview_progressbar_w</item>
         <item name="progress_mini_player">@drawable/progress_mini_player_dark</item>
         <item name="advanced_options_style">@style/Theme.MaterialComponents.Dialog</item>
-        <item name="rounded_bg">@drawable/rounded_corners</item>
+        <item name="advanced_options_bg">@drawable/rounded_corners</item>
         <item name="ic_playasaudio_off">@drawable/ic_playasaudio_off_w</item>
         <item name="ic_playasaudio_on">@drawable/ic_playasaudio_on_w</item>
         <item name="ic_popup_expand">@drawable/ic_popup_expand_w</item>
@@ -330,7 +330,7 @@
         <item name="colorAccent">@color/orange500</item>
 
         <item name="background_default">@color/grey850</item>
-        <item name="rounded_bg">@drawable/rounded_corners</item>
+        <item name="advanced_options_bg">@drawable/rounded_corners</item>
         <item name="advanced_options_style">@style/Theme.MaterialComponents.Dialog</item>
         <item name="ic_playasaudio_on">@drawable/ic_playasaudio_on_w</item>
         <item name="ic_popup_dim">@drawable/ic_popup_dim_w</item>
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt b/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
index 6fd1c98da..4ec3b6aaa 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
@@ -407,13 +407,9 @@ class PlayerOptionsDelegate(val activity: AppCompatActivity, val service: Playba
         }
 
         inner class ViewHolder(val binding: PlayerOptionItemBinding) : RecyclerView.ViewHolder(binding.root) {
-            val textColor = binding.optionTitle.currentTextColor
 
             init {
                 itemView.setOnClickListener { onClick(dataset[layoutPosition]) }
-                itemView.onFocusChangeListener = View.OnFocusChangeListener { _, hasFocus ->
-                    binding.optionTitle.setTextColor(if (hasFocus) ContextCompat.getColor(itemView.context, R.color.orange500transparent) else textColor)
-                }
             }
         }
     }



More information about the Android mailing list