[Android] Accessibility: make the InfoActivity duration accessible
Nicolas Pomepuy
git at videolan.org
Mon Jun 27 11:45:16 UTC 2022
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Jun 27 08:02:25 2022 +0200| [e1305d63de514e0bc5b9c0f310489e85eff4ef38] | committer: Duncan McNamara
Accessibility: make the InfoActivity duration accessible
> https://code.videolan.org/videolan/vlc-android/commit/e1305d63de514e0bc5b9c0f310489e85eff4ef38
---
application/vlc-android/res/layout/info_activity.xml | 16 ++++++++++++----
.../vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt | 8 +++++---
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/application/vlc-android/res/layout/info_activity.xml b/application/vlc-android/res/layout/info_activity.xml
index c9b83930a..32d5cfda9 100644
--- a/application/vlc-android/res/layout/info_activity.xml
+++ b/application/vlc-android/res/layout/info_activity.xml
@@ -9,6 +9,8 @@
<import type="org.videolan.medialibrary.Tools" />
+ <import type="org.videolan.vlc.gui.helpers.TalkbackUtil" />
+
<import type="org.videolan.medialibrary.media.MediaLibraryItem" />
<import type="android.text.TextUtils" />
@@ -24,7 +26,7 @@
<variable
name="length"
- type="String" />
+ type="Long" />
<variable
name="path"
@@ -42,6 +44,10 @@
name="sizeValueText"
type="String" />
+ <variable
+ name="sizeValueContentDescription"
+ type="String" />
+
<variable
name="extraValueText"
type="String" />
@@ -239,7 +245,7 @@
android:layout_marginStart="6dp"
android:layout_marginTop="8dp"
android:padding="8dp"
- android:visibility="@{TextUtils.isEmpty(length) ? View.GONE : View.VISIBLE}"
+ android:visibility="@{length == null ? View.GONE : View.VISIBLE}"
vlc:layout_constraintStart_toStartOf="parent"
vlc:layout_constraintTop_toBottomOf="@+id/directory_not_scanned_button"
vlc:srcCompat="@drawable/ic_duration" />
@@ -252,7 +258,7 @@
android:text="@string/length"
android:textColor="?attr/font_audio_light"
android:textStyle="bold"
- android:visibility="@{TextUtils.isEmpty(length) ? View.GONE : View.VISIBLE}"
+ android:visibility="@{length == null ? View.GONE : View.VISIBLE}"
vlc:layout_constraintBottom_toTopOf="@+id/length_value"
vlc:layout_constraintStart_toEndOf="@+id/length_icon"
vlc:layout_constraintTop_toTopOf="@+id/length_icon"
@@ -262,7 +268,8 @@
android:id="@+id/length_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@{length}"
+ android:text="@{Tools.millisToTextLarge(length)}"
+ android:contentDescription="@{TalkbackUtil.INSTANCE.millisToString(context,length)}"
android:textColor="?attr/font_audio_light"
tools:text="10:30"
vlc:layout_constraintBottom_toBottomOf="@+id/length_icon"
@@ -306,6 +313,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{sizeValueText}"
+ android:contentDescription="@{sizeValueContentDescription}"
android:textColor="?attr/font_audio_light"
tools:text="3MB"
vlc:layout_constraintBottom_toBottomOf="@+id/size_icon"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt
index 5e19dd105..e5c5f1745 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt
@@ -23,12 +23,14 @@ import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.snackbar.Snackbar
-import kotlinx.coroutines.*
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.isActive
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
import org.videolan.libvlc.FactoryManager
import org.videolan.libvlc.interfaces.IMedia
import org.videolan.libvlc.interfaces.IMediaFactory
import org.videolan.libvlc.util.Extensions
-import org.videolan.medialibrary.Tools
import org.videolan.medialibrary.interfaces.Medialibrary
import org.videolan.medialibrary.interfaces.media.Artist
import org.videolan.medialibrary.interfaces.media.MediaWrapper
@@ -138,7 +140,7 @@ class InfoActivity : AudioPlayerContainerActivity(), View.OnClickListener, PathA
val nbTracks = tracks?.size ?: 0
if (nbTracks > 0) for (media in tracks!!) length += media.length
if (length > 0)
- binding.length = Tools.millisToTextLarge(length)
+ binding.length = length
if (item is MediaWrapper) {
val media = item as MediaWrapper
More information about the Android
mailing list