[Android] Fix the negative sleep timer remaining time announced by talkback

Mohammad Usman Sajid git at videolan.org
Thu Oct 15 08:35:27 UTC 2026


vlc-android | branch: master | Mohammad Usman Sajid <usmansajid47007 at gmail.com> | Mon Sep 21 17:30:50 2026 +0500| [4b9ea8e26e5ffe3619ae944f39f0da0f761cb2c7] | committer: Nicolas Pomepuy

Fix the negative sleep timer remaining time announced by talkback

The content description of the video player sleep timer chip subtracts
the sleep time from the current time. The sleep time is in the future,
so the result is always negative and TalkbackUtil.millisToString renders
it with a leading minus sign. The label and the duration were also
concatenated without a separator, so talkback announced for example
"Sleep in-58 minutes 44 seconds".

Subtract in the correct order and join the two parts with
talkbackAppend, which is already used for this elsewhere.

> https://code.videolan.org/videolan/vlc-android/commit/4b9ea8e26e5ffe3619ae944f39f0da0f761cb2c7
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 8de5429631..66e3b10c0e 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
@@ -97,6 +97,7 @@ import org.videolan.vlc.gui.helpers.BookmarkListDelegate
 import org.videolan.vlc.gui.helpers.OnRepeatListenerKey
 import org.videolan.vlc.gui.helpers.SwipeDragItemTouchHelperCallback
 import org.videolan.vlc.gui.helpers.TalkbackUtil
+import org.videolan.vlc.gui.helpers.talkbackAppend
 import org.videolan.vlc.gui.helpers.UiTools
 import org.videolan.vlc.gui.helpers.UiTools.showVideoTrack
 import org.videolan.vlc.gui.helpers.hf.checkPIN
@@ -979,7 +980,7 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
             val format =  DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault())
             PlaybackService.playerSleepTime.value?.let {
                 hudRightBinding.sleepQuickAction.text = format.format(it.time)
-                hudRightBinding.sleepQuickAction.contentDescription = player.getString(R.string.sleep_in) + TalkbackUtil.millisToString(player, System.currentTimeMillis() - it.time.time)
+                hudRightBinding.sleepQuickAction.contentDescription = player.getString(R.string.sleep_in).talkbackAppend(TalkbackUtil.millisToString(player, it.time.time - System.currentTimeMillis()))
             }
             hudRightBinding.spuDelayQuickAction.text = "${(player.service?.spuDelay ?: 0L) / 1000L} ms"
             hudRightBinding.audioDelayQuickAction.text = "${(player.service?.audioDelay ?: 0L) / 1000L} ms"



More information about the Android mailing list