Use resolved weights for episode rating labels
This commit is contained in:
parent
c07bb2ca1d
commit
c534ea75c2
1 changed files with 2 additions and 3 deletions
|
|
@ -20,7 +20,6 @@ import androidx.compose.ui.graphics.ColorMatrix
|
|||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.rememberTextMeasurer
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
import androidx.tv.material3.Text
|
||||
|
|
@ -49,7 +48,7 @@ fun HomeRatingsRow(ratings: List<HomeRating>, modifier: Modifier = Modifier, fon
|
|||
}
|
||||
val muted = rating.mark == "tomato"
|
||||
Image(painterResource(resource), null, Modifier.size(size * if (rating.mark == "imdb" || rating.mark == "tmdb") 1.8f else 1f, size).graphicsLayer { alpha = if (muted) .55f else 1f }, colorFilter = if (muted) ColorFilter.colorMatrix(ColorMatrix().apply { setToSaturation(0f) }) else null)
|
||||
if (rating.episode) Text("Ep", color = C.muted, style = T.ratingPlate.copy(fontSize = fontSize, lineHeight = fontSize * 1.2f, fontWeight = FontWeight.SemiBold), maxLines = 1)
|
||||
if (rating.episode) Text("Ep", color = C.muted, style = T.ratingPlate.copy(fontSize = fontSize, lineHeight = fontSize * 1.2f, fontWeight = T.label.fontWeight), maxLines = 1)
|
||||
Text(rating.format(), color = C.fg, style = T.ratingPlate.copy(fontSize = fontSize, lineHeight = fontSize * 1.2f, fontFeatureSettings = "tnum"), maxLines = 1, softWrap = false)
|
||||
}
|
||||
}
|
||||
|
|
@ -74,7 +73,7 @@ fun HomeRatingPlate(ratings: List<HomeRating>, visible: Boolean, modifier: Modif
|
|||
return entries.sumOf { rating ->
|
||||
val mark = em * if (rating.mark == "imdb" || rating.mark == "tmdb") 1.8f else 1f
|
||||
val number = measurer.measure(rating.format(locale), T.ratingPlate.copy(fontSize = size)).size.width
|
||||
val episode = if (rating.episode) measurer.measure("Ep", T.ratingPlate.copy(fontSize = size, fontWeight = FontWeight.SemiBold)).size.width + em * .29f else 0f
|
||||
val episode = if (rating.episode) measurer.measure("Ep", T.ratingPlate.copy(fontSize = size, fontWeight = T.label.fontWeight)).size.width + em * .29f else 0f
|
||||
(mark + em * .29f + number + episode).toDouble()
|
||||
}.toFloat() + (entries.size - 1).coerceAtLeast(0) * em * .64f
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue