[Android] Set video player accessibility descriptions

Geoffrey Métais git at videolan.org
Mon Jul 2 11:40:42 CEST 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun 14 14:19:58 2018 +0200| [3b459545d461ce136d02945b988c39a94a8804a9] | committer: Geoffrey Métais

Set video player accessibility descriptions

(cherry picked from commit 5e67c4e94e02ae3c2d5f2195b0be7c7a89635e3e)

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

 vlc-android/res/layout/audio_player.xml |  9 +++++----
 vlc-android/res/layout/player_hud.xml   | 11 ++++++++++-
 vlc-android/res/values/strings.xml      |  2 ++
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/vlc-android/res/layout/audio_player.xml b/vlc-android/res/layout/audio_player.xml
index 5f8a44692..20bef4345 100644
--- a/vlc-android/res/layout/audio_player.xml
+++ b/vlc-android/res/layout/audio_player.xml
@@ -156,7 +156,7 @@
                 android:layout_gravity="center"
                 android:layout_marginRight="@dimen/default_margin"
                 android:layout_marginEnd="@dimen/default_margin"
-                android:contentDescription="@string/pause"
+                android:contentDescription="@string/play"
                 android:focusable="true"
                 android:scaleType="fitXY"
                 android:onClick="@{fragment::onPlayPauseClick}"
@@ -252,6 +252,7 @@
             android:layout_marginRight="@dimen/default_margin"
             android:layout_marginEnd="@dimen/default_margin"
             android:text="@string/time_0"
+            android:contentDescription="@string/length"
             android:textSize="12sp" />
 
         <ImageView
@@ -263,7 +264,7 @@
             app:layout_constraintTop_toTopOf="@+id/play_pause"
             android:layout_marginLeft="@dimen/default_margin"
             android:layout_marginStart="@dimen/default_margin"
-            android:contentDescription="@string/shuffle"
+            android:contentDescription="@string/shuffle_title"
             android:focusable="true"
             android:scaleType="fitXY"
             android:src="?attr/ic_shuffle"
@@ -278,7 +279,7 @@
             app:layout_constraintTop_toTopOf="@+id/play_pause"
             android:layout_marginRight="@dimen/default_margin"
             android:layout_marginEnd="@dimen/default_margin"
-            android:contentDescription="@string/repeat"
+            android:contentDescription="@string/repeat_title"
             android:focusable="true"
             android:onClick="@{fragment::onRepeatClick}"
             android:scaleType="fitXY"
@@ -291,7 +292,7 @@
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintLeft_toRightOf="@+id/previous"
             app:layout_constraintRight_toLeftOf="@+id/next"
-            android:contentDescription="@string/pause"
+            android:contentDescription="@string/play"
             android:focusable="true"
             android:scaleType="fitXY"
             android:onClick="@{fragment::onPlayPauseClick}"
diff --git a/vlc-android/res/layout/player_hud.xml b/vlc-android/res/layout/player_hud.xml
index 427552dde..ff28518b6 100644
--- a/vlc-android/res/layout/player_hud.xml
+++ b/vlc-android/res/layout/player_hud.xml
@@ -96,6 +96,7 @@
             android:src="@drawable/ic_lock_circle"
             android:scaleType="center"
             android:onClick="@{(v) -> player.toggleLock()}"
+            android:contentDescription="@string/lock"
             android:focusable="true"/>
 
         <ImageView
@@ -107,6 +108,7 @@
             android:src="@drawable/ic_audiosub_circle"
             android:scaleType="center"
             android:onClick="@{player::onAudioSubClick}"
+            android:contentDescription="@string/tracks"
             android:focusable="true"/>
 
         <ImageView
@@ -120,6 +122,7 @@
             android:scaleType="center"
             android:onClick="@{(v) -> player.previous()}"
             android:src="@drawable/ic_playlist_previous_circle"
+            android:contentDescription="@string/previous"
             android:visibility="gone" />
 
         <ImageView
@@ -132,6 +135,7 @@
             android:longClickable="true"
             android:scaleType="center"
             android:src="@drawable/ic_rewind_circle"
+            android:contentDescription="@string/playback_rewind"
             android:visibility="gone" />
 
         <ImageView
@@ -144,7 +148,8 @@
             android:scaleType="fitCenter"
             android:focusable="true"
             android:onClick="@{(v) -> player.doPlayPause()}"
-            android:onLongClick="@{player::toggleLoop}"/>
+            android:onLongClick="@{player::toggleLoop}"
+            android:contentDescription="@string/play"/>
 
         <ImageView
             android:id="@+id/player_overlay_forward"
@@ -156,6 +161,7 @@
             android:src="@drawable/ic_forward_circle"
             android:scaleType="center"
             android:focusable="true"
+            android:contentDescription="@string/playback_forward"
             android:visibility="gone" />
 
         <ImageView
@@ -169,6 +175,7 @@
             android:scaleType="center"
             android:focusable="true"
             android:onClick="@{(v) -> player.next()}"
+            android:contentDescription="@string/next"
             android:visibility="gone" />
 
         <ImageView
@@ -180,6 +187,7 @@
             android:src="@drawable/ic_more_circle"
             android:scaleType="center"
             android:onClick="@{(v) -> player.showAdvancedOptions()}"
+            android:contentDescription="@string/advanced"
             android:focusable="true"/>
 
         <ImageView
@@ -190,6 +198,7 @@
             android:src="@drawable/ic_crop_circle_o"
             android:scaleType="center"
             android:onClick="@{(v) -> player.resizeVideo()}"
+            android:contentDescription="@string/resize"
             android:focusable="true" />
     </LinearLayout>
 </RelativeLayout>
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 56d9f528d..cf5470764 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -602,4 +602,6 @@
     <string name="audio_digital_output_enabled">Audio Digital Output enabled</string>
     <string name="audio_digital_output_disabled">Audio Digital Output disabled</string>
     <string name="audio_digital_title">Digital audio output (passthrough)</string>
+    <string name="playback_rewind">Rewind</string>
+    <string name="playback_forward">Fast forward</string>
 </resources>



More information about the Android mailing list