[Android] Audio player: display the remaining time at the right corner

Nicolas Pomepuy git at videolan.org
Mon Mar 20 08:35:27 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Mar 17 09:02:36 2023 +0100| [195383d23ac4ecb529daa8c0e374f86364c343bd] | committer: Nicolas Pomepuy

Audio player: display the remaining time at the right corner

For consistency with the video player
Fixes #2821

> https://code.videolan.org/videolan/vlc-android/commit/195383d23ac4ecb529daa8c0e374f86364c343bd
---

 .../vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index 2be5d4999a..c243a947e9 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -441,12 +441,12 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
      */
     private fun updateProgress(progress: PlaybackProgress) {
         if (playlistModel.currentMediaPosition == -1) return
-        binding.length.text = progress.lengthText
+        binding.length.text = if (showRemainingTime) Tools.millisToString(progress.time - progress.length) else progress.lengthText
         binding.timeline.max = progress.length.toInt()
         binding.progressBar.max = progress.length.toInt()
 
         if (!previewingSeek) {
-            val displayTime = if (showRemainingTime) Tools.millisToString(progress.time - progress.length) else progress.timeText
+            val displayTime = progress.timeText
             binding.headerTime.text = displayTime
             binding.time.text = displayTime
             if (!isDragging) binding.timeline.progress = progress.time.toInt()
@@ -736,7 +736,7 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
                     else if (possibleSeek <= 4000) possibleSeek = 0
                 }
 
-                binding.time.text = Tools.millisToString(if (showRemainingTime) possibleSeek - length else possibleSeek.toLong())
+                binding.time.text = Tools.millisToString(possibleSeek.toLong())
                 binding.timeline.progress = possibleSeek
                 binding.progressBar.progress = possibleSeek
                 handler.postDelayed(this, 50)
@@ -803,7 +803,7 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
         override fun onProgressChanged(sb: SeekBar, progress: Int, fromUser: Boolean) {
             if (fromUser) {
                 playlistModel.setTime(progress.toLong(), true)
-                binding.time.text = Tools.millisToString(if (showRemainingTime) progress - playlistModel.length else progress.toLong())
+                binding.time.text = Tools.millisToString(progress.toLong())
                 binding.headerTime.text = Tools.millisToString(progress.toLong())
                 binding.timeline.forceAccessibilityUpdate()
             }



More information about the Android mailing list