mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
Use aspect ratio for banner cards
This commit is contained in:
parent
b6f9aee5d4
commit
933dc4fd5a
3 changed files with 10 additions and 5 deletions
|
|
@ -5,6 +5,7 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
|
|||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
|
|
@ -36,22 +37,22 @@ fun BannerCard(
|
|||
onClick: () -> Unit,
|
||||
onLongClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
cardWidth: Dp = 200.dp,
|
||||
cardHeight: Dp = cardWidth * 9 / 16,
|
||||
cardHeight: Dp = 140.dp,
|
||||
aspectRatio: Float = 16f / 9,
|
||||
interactionSource: MutableInteractionSource? = null,
|
||||
) {
|
||||
Card(
|
||||
modifier = modifier.size(cardWidth, cardHeight),
|
||||
modifier = modifier.size(cardHeight * aspectRatio, cardHeight),
|
||||
onClick = onClick,
|
||||
onLongClick = onLongClick,
|
||||
interactionSource = interactionSource,
|
||||
) {
|
||||
Box {
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
AsyncImage(
|
||||
model = imageUrl,
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Fit,
|
||||
modifier = Modifier,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
)
|
||||
if (played || cornerText.isNotNullOrBlank()) {
|
||||
Row(
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ class SeriesViewModel
|
|||
ItemFields.OVERVIEW,
|
||||
ItemFields.CUSTOM_RATING,
|
||||
ItemFields.TRICKPLAY,
|
||||
ItemFields.PRIMARY_IMAGE_ASPECT_RATIO,
|
||||
),
|
||||
)
|
||||
val pager = ApiRequestPager(api, request, GetEpisodesRequestHandler, viewModelScope)
|
||||
|
|
|
|||
|
|
@ -191,6 +191,9 @@ fun SeriesOverviewContent(
|
|||
}
|
||||
BannerCard(
|
||||
imageUrl = episode?.imageUrl,
|
||||
aspectRatio =
|
||||
episode?.data?.primaryImageAspectRatio?.toFloat()
|
||||
?: (16f / 9),
|
||||
cornerText = "E${episode?.data?.indexNumber}",
|
||||
played = episode?.data?.userData?.played ?: false,
|
||||
playPercent = episode?.data?.userData?.playedPercentage ?: 0.0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue