[Android] Accessibility: improve talkback for the playback speed

Nicolas Pomepuy git at videolan.org
Fri Jun 3 11:30:21 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue May 24 12:13:35 2022 +0200| [542eef76dcbaf3bcb830ee827c87cd33d1a34685] | committer: Nicolas Pomepuy

Accessibility: improve talkback for the playback speed

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

 application/resources/src/main/res/values/strings.xml                | 2 ++
 application/vlc-android/res/layout/dialog_playback_speed.xml         | 5 +++++
 .../src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.kt          | 2 ++
 .../src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt     | 1 +
 4 files changed, 10 insertions(+)

diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index b860ca938..7cbce2d3e 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -1010,6 +1010,8 @@
     <string name="selected">Selected</string>
     <string name="talkback_increase_delay">Increase delay</string>
     <string name="talkback_decrease_delay">Decrease delay</string>
+    <string name="talkback_increase_speed">Increase speed</string>
+    <string name="talkback_decrease_speed">Decrease speed</string>
     <string name="talkback_subtitle_history">Subtitle history</string>
     <string name="talkback_language_selection">%s selected languages</string>
     <string name="downloaded">Downloaded</string>
diff --git a/application/vlc-android/res/layout/dialog_playback_speed.xml b/application/vlc-android/res/layout/dialog_playback_speed.xml
index c5a2e71b3..b71f2efb1 100644
--- a/application/vlc-android/res/layout/dialog_playback_speed.xml
+++ b/application/vlc-android/res/layout/dialog_playback_speed.xml
@@ -26,6 +26,7 @@
             android:layout_weight="1"
             android:text="0.25"
             android:textSize="12sp"
+            android:importantForAccessibility="no"
             app:layout_constraintBaseline_toBaselineOf="@id/playback_speed_value"
             app:layout_constraintEnd_toStartOf="@+id/playback_speed_value"
             app:layout_constraintHorizontal_bias="0.5"
@@ -53,6 +54,7 @@
             android:layout_height="wrap_content"
             android:layout_marginEnd="16dp"
             android:layout_weight="1"
+            android:importantForAccessibility="no"
             android:gravity="bottom|right"
             android:text="4.00"
             android:textSize="12sp"
@@ -71,6 +73,7 @@
             android:focusable="true"
             android:indeterminate="false"
             android:max="200"
+            android:importantForAccessibility="no"
             android:maxHeight="@dimen/seekbar_height"
             android:minHeight="@dimen/seekbar_height"
             android:nextFocusUp="@+id/playback_speed_icon"
@@ -92,6 +95,7 @@
             android:nextFocusUp="@+id/playback_speed_seek"
             android:nextFocusDown="@+id/playback_speed_minus"
             android:padding="0dp"
+            android:contentDescription="@string/talkback_increase_speed"
             app:backgroundTint="@color/transparent"
             app:layout_constraintBottom_toTopOf="@+id/playback_speed_minus"
             app:layout_constraintEnd_toEndOf="parent"
@@ -105,6 +109,7 @@
             android:layout_marginEnd="8dp"
             android:nextFocusUp="@+id/playback_speed_plus"
             android:nextFocusDown="@+id/playback_speed_icon"
+            android:contentDescription="@string/talkback_decrease_speed"
             android:padding="0dp"
             app:backgroundTint="@color/transparent"
             app:layout_constraintBottom_toTopOf="@+id/stream_warning"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.kt
index 8ff4cb3a7..e3820739b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.kt
@@ -140,6 +140,8 @@ class PlaybackSpeedDialog : VLCBottomSheetDialogFragment() {
         val rate = ((initialRate + delta) * 100f).roundToInt() / 100f
         if (rate < 0.25f || rate > 4f || playbackService!!.currentMediaWrapper == null)
             return
+        seekSpeed.announceForAccessibility(rate.toString())
+        seekSpeed.contentDescription = rate.toString()
         playbackService!!.setRate(rate, true)
     }
 
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
index 209806837..c5262aacc 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
@@ -826,6 +826,7 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
             hudRightBinding.audioDelayQuickAction.visibility = if (show && player.service?.audioDelay != 0L) View.VISIBLE else View.GONE
 
             hudRightBinding.playbackSpeedQuickAction.text = player.service?.rate?.formatRateString()
+            hudRightBinding.playbackSpeedQuickAction.contentDescription = player.getString(R.string.playback_speed)+ ". " + player.service?.rate?.formatRateString()
             val format =  DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault())
             PlaybackService.playerSleepTime.value?.let {
                 hudRightBinding.sleepQuickAction.text = format.format(it.time)



More information about the Android mailing list