[Android] Fix playlist duration display
Robert Stone
git at videolan.org
Tue Mar 29 05:52:20 UTC 2022
vlc-android | branch: master | Robert Stone <rhstone at gmail.com> | Mon Mar 28 20:05:15 2022 -0700| [0407400d17f02d0198cdbd13b1d34192cc7e2bd4] | committer: Nicolas Pomepuy
Fix playlist duration display
> https://code.videolan.org/videolan/vlc-android/commit/0407400d17f02d0198cdbd13b1d34192cc7e2bd4
---
.../vlc-android/src/org/videolan/vlc/util/Kextensions.kt | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/util/Kextensions.kt b/application/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
index 52fc89701..02fb5f44d 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
@@ -13,7 +13,6 @@ import android.text.SpannableString
import android.text.style.DynamicDrawableSpan
import android.text.style.ImageSpan
import android.util.DisplayMetrics
-import android.util.Log
import android.view.View
import android.widget.TextView
import androidx.annotation.WorkerThread
@@ -32,7 +31,6 @@ import com.google.android.material.snackbar.Snackbar
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
-import org.videolan.BuildConfig
import org.videolan.libvlc.Media
import org.videolan.libvlc.interfaces.IMedia
import org.videolan.libvlc.util.AndroidUtil
@@ -50,7 +48,6 @@ import org.videolan.tools.AppScope
import org.videolan.tools.isStarted
import org.videolan.vlc.R
import java.io.File
-import java.lang.StringBuilder
import java.net.URI
import java.net.URISyntaxException
import java.security.SecureRandom
@@ -176,9 +173,11 @@ fun asyncTextItem(view: TextView, item: MediaLibraryItem?) {
view.visibility = View.GONE
return
}
- val text = if (item is Playlist){
- val duration = if (item.duration != 0L) Tools.millisToString(item.duration) else null
- TextUtils.separatedString(view.context.getString(R.string.track_number, item.tracksCount), if (item.nbDurationUnknown > 0) "$duration+" else duration)
+ val text = if (item is Playlist) {
+ if (item.duration != 0L) {
+ val duration = Tools.millisToString(item.duration)
+ TextUtils.separatedString(view.context.getString(R.string.track_number, item.tracksCount), if (item.nbDurationUnknown > 0) "$duration+" else duration)
+ } else view.context.getString(R.string.track_number, item.tracksCount)
} else item.description
if (text.isNullOrEmpty()) {
view.visibility = View.GONE
More information about the Android
mailing list