[Android] [PATCH] AudioPlayer Header: focus related resource improvements for R.id.header_play_pause

Mik Amchislavsky hailmikhail at gmail.com
Mon Oct 13 12:59:18 CEST 2014


---
 .../drawable/ic_pause_for_header_play_pause.xml    |    7 +++++++
 .../drawable/ic_pause_for_header_play_pause_w.xml  |    7 +++++++
 .../res/drawable/ic_play_for_header_play_pause.xml |    7 +++++++
 .../drawable/ic_play_for_header_play_pause_w.xml   |    7 +++++++
 vlc-android/res/layout/audio_player.xml            |    9 +++++++--
 vlc-android/res/values/attrs.xml                   |    4 +++-
 vlc-android/res/values/styles.xml                  |    4 ++++
 7 files changed, 42 insertions(+), 3 deletions(-)
 create mode 100644 vlc-android/res/drawable/ic_pause_for_header_play_pause.xml
 create mode 100644 vlc-android/res/drawable/ic_pause_for_header_play_pause_w.xml
 create mode 100644 vlc-android/res/drawable/ic_play_for_header_play_pause.xml
 create mode 100644 vlc-android/res/drawable/ic_play_for_header_play_pause_w.xml

diff --git a/vlc-android/res/drawable/ic_pause_for_header_play_pause.xml b/vlc-android/res/drawable/ic_pause_for_header_play_pause.xml
new file mode 100644
index 0000000..4b857ed
--- /dev/null
+++ b/vlc-android/res/drawable/ic_pause_for_header_play_pause.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">  
+    <item android:drawable="@drawable/ic_pause_pressed_w" android:state_focused="true" android:state_pressed="false"/>
+    <item android:drawable="@drawable/ic_pause_pressed" android:state_focused="true" android:state_pressed="true"/>
+    <item android:drawable="@drawable/ic_pause_pressed" android:state_focused="false" android:state_pressed="true"/>
+    <item android:drawable="@drawable/ic_pause_normal"/>    
+</selector>
diff --git a/vlc-android/res/drawable/ic_pause_for_header_play_pause_w.xml b/vlc-android/res/drawable/ic_pause_for_header_play_pause_w.xml
new file mode 100644
index 0000000..0ef436d
--- /dev/null
+++ b/vlc-android/res/drawable/ic_pause_for_header_play_pause_w.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">  
+    <item android:drawable="@drawable/ic_pause_pressed" android:state_focused="true" android:state_pressed="false"/>
+    <item android:drawable="@drawable/ic_pause_pressed_w" android:state_focused="true" android:state_pressed="true"/>
+    <item android:drawable="@drawable/ic_pause_pressed_w" android:state_focused="false" android:state_pressed="true"/>
+    <item android:drawable="@drawable/ic_pause_normal_w"/>    
+</selector>
diff --git a/vlc-android/res/drawable/ic_play_for_header_play_pause.xml b/vlc-android/res/drawable/ic_play_for_header_play_pause.xml
new file mode 100644
index 0000000..5f7458b
--- /dev/null
+++ b/vlc-android/res/drawable/ic_play_for_header_play_pause.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">  
+    <item android:drawable="@drawable/ic_play_pressed_w" android:state_focused="true" android:state_pressed="false"/>
+    <item android:drawable="@drawable/ic_play_pressed" android:state_focused="true" android:state_pressed="true"/>
+    <item android:drawable="@drawable/ic_play_pressed" android:state_focused="false" android:state_pressed="true"/>
+    <item android:drawable="@drawable/ic_play_normal"/>    
+</selector>
diff --git a/vlc-android/res/drawable/ic_play_for_header_play_pause_w.xml b/vlc-android/res/drawable/ic_play_for_header_play_pause_w.xml
new file mode 100644
index 0000000..c7f14ac
--- /dev/null
+++ b/vlc-android/res/drawable/ic_play_for_header_play_pause_w.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">  
+    <item android:drawable="@drawable/ic_play_pressed" android:state_focused="true" android:state_pressed="false"/>
+    <item android:drawable="@drawable/ic_play_pressed_w" android:state_focused="true" android:state_pressed="true"/>
+    <item android:drawable="@drawable/ic_play_pressed_w" android:state_focused="false" android:state_pressed="true"/>
+    <item android:drawable="@drawable/ic_play_normal_w"/>    
+</selector>
diff --git a/vlc-android/res/layout/audio_player.xml b/vlc-android/res/layout/audio_player.xml
index cfffd5d..e98caf6 100644
--- a/vlc-android/res/layout/audio_player.xml
+++ b/vlc-android/res/layout/audio_player.xml
@@ -76,7 +76,12 @@
             android:contentDescription="@string/pause"
             android:focusable="true"
             android:scaleType="fitXY"
-            android:src="?attr/ic_pause" />
+            android:src="?attr/ic_pause_for_header_play_pause"
+            android:nextFocusForward="@+id/header_play_pause"
+            android:nextFocusUp="@+id/ml_menu_search"
+            android:nextFocusDown="@id/header_play_pause"
+            android:nextFocusLeft="@id/header_play_pause"
+            android:nextFocusRight="@id/header_play_pause" />
 
         <View
             android:layout_width="10dp"
@@ -213,4 +218,4 @@
             android:src="?attr/ic_previous" />
     </RelativeLayout>
 
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/vlc-android/res/values/attrs.xml b/vlc-android/res/values/attrs.xml
index cf6a7ee..ea9d657 100644
--- a/vlc-android/res/values/attrs.xml
+++ b/vlc-android/res/values/attrs.xml
@@ -39,6 +39,8 @@
     <attr name="ic_audio_player_dots" format="reference" />
     <attr name="ic_play" format="reference" />
     <attr name="ic_pause" format="reference" />
+    <attr name="ic_play_for_header_play_pause" format="reference" />
+    <attr name="ic_pause_for_header_play_pause" format="reference" />
     <attr name="ic_previous" format="reference" />
     <attr name="ic_next" format="reference" />
     <attr name="ic_menu_video" format="reference" />
@@ -60,4 +62,4 @@
 
     <attr name="marginTopContent" format="dimension" />
 
-</resources>
\ No newline at end of file
+</resources>
diff --git a/vlc-android/res/values/styles.xml b/vlc-android/res/values/styles.xml
index 6d69293..ca844a0 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -58,6 +58,8 @@
         <item name="ic_audio_player_dots">@drawable/dots_dark</item>
         <item name="ic_play">@drawable/ic_play</item>
         <item name="ic_pause">@drawable/ic_pause</item>
+        <item name="ic_play_for_header_play_pause">@drawable/ic_play_for_header_play_pause</item>
+        <item name="ic_pause_for_header_play_pause">@drawable/ic_pause_for_header_play_pause</item>
         <item name="ic_previous">@drawable/ic_previous</item>
         <item name="ic_next">@drawable/ic_next</item>
         <item name="ic_menu_video">@drawable/ic_menu_video</item>
@@ -119,6 +121,8 @@
         <item name="ic_audio_player_dots">@drawable/dots</item>
         <item name="ic_play">@drawable/ic_play_w</item>
         <item name="ic_pause">@drawable/ic_pause_w</item>
+        <item name="ic_play_for_header_play_pause">@drawable/ic_play_for_header_play_pause_w</item>
+        <item name="ic_pause_for_header_play_pause">@drawable/ic_pause_for_header_play_pause_w</item>
         <item name="ic_previous">@drawable/ic_previous_w</item>
         <item name="ic_next">@drawable/ic_next_w</item>
         <item name="ic_menu_video">@drawable/ic_menu_video_w</item>
-- 
1.7.9.5



More information about the Android mailing list