Fix progress bar

This commit is contained in:
2026-01-17 18:05:27 +01:00
parent 876bc03696
commit 3bd8d423d2
3 changed files with 5 additions and 4 deletions

View File

@@ -49,7 +49,7 @@ class HomePageViewModel @Inject constructor(
id = it.id, id = it.id,
primaryText = it.seriesName!!, primaryText = it.seriesName!!,
secondaryText = it.name!!, secondaryText = it.name!!,
progress = it.userData!!.playedPercentage!!.toFloat(), progress = it.userData!!.playedPercentage!!,
colors = listOf(Color.Red, Color.Green), colors = listOf(Color.Red, Color.Green),
) )
} else { } else {
@@ -58,7 +58,7 @@ class HomePageViewModel @Inject constructor(
primaryText = it.name!!, primaryText = it.name!!,
secondaryText = it.premiereDate!!.format(DateTimeFormatter.ofLocalizedDate( secondaryText = it.premiereDate!!.format(DateTimeFormatter.ofLocalizedDate(
FormatStyle.MEDIUM)), FormatStyle.MEDIUM)),
progress = it.userData!!.playedPercentage!!.toFloat(), progress = it.userData!!.playedPercentage!!,
colors = listOf(Color.Red, Color.Green) colors = listOf(Color.Red, Color.Green)
) )
} }

View File

@@ -8,7 +8,7 @@ data class ContinueWatchingItem(
val id: UUID, val id: UUID,
val primaryText: String, val primaryText: String,
val secondaryText: String, val secondaryText: String,
val progress: Float, val progress: Double,
val colors: List<Color> val colors: List<Color>
) )

View File

@@ -33,6 +33,7 @@ import androidx.compose.ui.unit.sp
import coil3.compose.AsyncImage import coil3.compose.AsyncImage
import hu.bbara.purefin.image.JellyfinImageHelper import hu.bbara.purefin.image.JellyfinImageHelper
import org.jellyfin.sdk.model.api.ImageType import org.jellyfin.sdk.model.api.ImageType
import kotlin.math.nextUp
@Composable @Composable
fun ContinueWatchingSection( fun ContinueWatchingSection(
@@ -105,7 +106,7 @@ fun ContinueWatchingCard(
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxHeight() .fillMaxHeight()
.fillMaxWidth(item.progress) .fillMaxWidth(item.progress.toFloat().nextUp().div(100))
.background(colors.primary) .background(colors.primary)
) )
} }