[Android] Accessibility: fix crash for MediaWrapper of type ALL
Nicolas Pomepuy
git at videolan.org
Fri Jun 3 11:30:22 UTC 2022
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Jun 2 07:24:15 2022 +0200| [6cddeac860f58149c847aa7ce19c81aea9f965c5] | committer: Nicolas Pomepuy
Accessibility: fix crash for MediaWrapper of type ALL
> https://code.videolan.org/videolan/vlc-android/commit/6cddeac860f58149c847aa7ce19c81aea9f965c5
---
.../vlc-android/src/org/videolan/vlc/gui/helpers/TalkbackUtil.kt | 2 ++
.../vlc-android/src/org/videolan/vlc/util/AccessibilityHelper.kt | 1 +
2 files changed, 3 insertions(+)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/TalkbackUtil.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/TalkbackUtil.kt
index 43dadb8f3..5b39bb1f5 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/TalkbackUtil.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/TalkbackUtil.kt
@@ -92,6 +92,8 @@ object TalkbackUtil {
return text
}
+ fun getAll(media: MediaLibraryItem): String = media.title
+
fun millisToString(context: Context, duration: Long): String {
var millis = duration
val sb = StringBuilder()
diff --git a/application/vlc-android/src/org/videolan/vlc/util/AccessibilityHelper.kt b/application/vlc-android/src/org/videolan/vlc/util/AccessibilityHelper.kt
index abf724520..6d8e172c2 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/AccessibilityHelper.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/AccessibilityHelper.kt
@@ -53,6 +53,7 @@ fun mediaDescription(v: View, media: MediaLibraryItem) {
MediaWrapper.TYPE_AUDIO -> TalkbackUtil.getAudioTrack(v.context, media)
MediaWrapper.TYPE_STREAM -> TalkbackUtil.getStream(v.context, media)
MediaWrapper.TYPE_DIR, MediaWrapper.TYPE_SUBTITLE, MediaWrapper.TYPE_PLAYLIST-> TalkbackUtil.getDir(v.context, media, false)
+ MediaWrapper.TYPE_ALL -> TalkbackUtil.getAll(media)
else -> throw NotImplementedError("Media type not found: ${media.type}")
}
else -> throw NotImplementedError("Unknown item type")
More information about the Android
mailing list