From 0407400d17f02d0198cdbd13b1d34192cc7e2bd4 Mon Sep 17 00:00:00 2001 From: Robert Stone Date: Mon, 28 Mar 2022 20:05:15 -0700 Subject: [PATCH] Fix playlist duration display --- .../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