mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-16 23:12:12 +00:00
Revert "ref: adjust tablet hero height calculation"
This reverts commit 4609398b59.
This commit is contained in:
parent
bbd785138b
commit
9e5219b4be
3 changed files with 11 additions and 43 deletions
|
|
@ -580,7 +580,6 @@ fun MetaDetailsScreen(
|
|||
|
||||
BoxWithConstraints(modifier = Modifier.fillMaxSize()) {
|
||||
val isTablet = maxWidth >= 720.dp
|
||||
val viewportHeight = maxHeight
|
||||
val contentHorizontalPadding = if (isTablet) 32.dp else 18.dp
|
||||
val contentMaxWidth = detailTabletContentMaxWidth(maxWidth, isTablet)
|
||||
val cinematicEnabled = metaScreenSettingsUiState.cinematicBackground
|
||||
|
|
@ -613,7 +612,6 @@ fun MetaDetailsScreen(
|
|||
DetailHero(
|
||||
meta = meta,
|
||||
isTablet = isTablet,
|
||||
viewportHeight = viewportHeight,
|
||||
contentMaxWidth = contentMaxWidth,
|
||||
scrollOffset = scrollState.value,
|
||||
onHeightChanged = { heroHeightPx = it },
|
||||
|
|
|
|||
|
|
@ -25,14 +25,12 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import coil3.compose.AsyncImage
|
||||
import com.nuvio.app.features.details.MetaDetails
|
||||
import com.nuvio.app.features.home.components.homeHeroLayout
|
||||
|
||||
@Composable
|
||||
fun DetailHero(
|
||||
meta: MetaDetails,
|
||||
isTablet: Boolean = false,
|
||||
scrollOffset: Int = 0,
|
||||
viewportHeight: Dp? = null,
|
||||
contentMaxWidth: Dp = 560.dp,
|
||||
onHeightChanged: (Int) -> Unit = {},
|
||||
modifier: Modifier = Modifier,
|
||||
|
|
@ -40,10 +38,7 @@ fun DetailHero(
|
|||
BoxWithConstraints(
|
||||
modifier = modifier.fillMaxWidth(),
|
||||
) {
|
||||
val heroHeight = homeHeroLayout(
|
||||
maxWidthDp = maxWidth.value,
|
||||
viewportHeightDp = viewportHeight?.value,
|
||||
).heroHeight
|
||||
val heroHeight = detailHeroHeight(maxWidth, isTablet)
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
|
|
@ -139,3 +134,10 @@ fun DetailHero(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun detailHeroHeight(maxWidth: Dp, isTablet: Boolean): Dp =
|
||||
if (!isTablet) {
|
||||
(maxWidth * 1.33f).coerceIn(420.dp, 760.dp)
|
||||
} else {
|
||||
(maxWidth * 0.42f).coerceIn(300.dp, 420.dp)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ private const val HERO_SWIPE_VELOCITY_THRESHOLD = 300f
|
|||
private const val MOBILE_HERO_VIEWPORT_RATIO = 0.78f
|
||||
private const val MOBILE_HERO_MIN_HEIGHT_DP = 360f
|
||||
private const val MOBILE_HERO_MAX_HEIGHT_DP = 760f
|
||||
private const val TABLET_HERO_VIEWPORT_RATIO = 0.62f
|
||||
|
||||
internal data class HomeHeroLayout(
|
||||
val isTablet: Boolean,
|
||||
|
|
@ -427,13 +426,7 @@ internal fun homeHeroLayout(
|
|||
when {
|
||||
maxWidthDp >= 1200f -> HomeHeroLayout(
|
||||
isTablet = true,
|
||||
heroHeight = tabletHeroHeight(
|
||||
maxWidthDp = maxWidthDp,
|
||||
viewportHeightDp = viewportHeightDp,
|
||||
widthRatio = 0.42f,
|
||||
minHeight = 500.dp,
|
||||
maxHeight = 640.dp,
|
||||
),
|
||||
heroHeight = (maxWidthDp * 0.42f).dp.coerceIn(360.dp, 440.dp),
|
||||
contentMaxWidth = 640.dp,
|
||||
contentWidthFraction = 0.56f,
|
||||
contentHorizontalPadding = 56.dp,
|
||||
|
|
@ -443,13 +436,7 @@ internal fun homeHeroLayout(
|
|||
)
|
||||
maxWidthDp >= 840f -> HomeHeroLayout(
|
||||
isTablet = true,
|
||||
heroHeight = tabletHeroHeight(
|
||||
maxWidthDp = maxWidthDp,
|
||||
viewportHeightDp = viewportHeightDp,
|
||||
widthRatio = 0.46f,
|
||||
minHeight = 460.dp,
|
||||
maxHeight = 580.dp,
|
||||
),
|
||||
heroHeight = (maxWidthDp * 0.46f).dp.coerceIn(340.dp, 420.dp),
|
||||
contentMaxWidth = 560.dp,
|
||||
contentWidthFraction = 0.62f,
|
||||
contentHorizontalPadding = 40.dp,
|
||||
|
|
@ -459,13 +446,7 @@ internal fun homeHeroLayout(
|
|||
)
|
||||
maxWidthDp >= 600f -> HomeHeroLayout(
|
||||
isTablet = true,
|
||||
heroHeight = tabletHeroHeight(
|
||||
maxWidthDp = maxWidthDp,
|
||||
viewportHeightDp = viewportHeightDp,
|
||||
widthRatio = 0.58f,
|
||||
minHeight = 420.dp,
|
||||
maxHeight = 520.dp,
|
||||
),
|
||||
heroHeight = (maxWidthDp * 0.58f).dp.coerceIn(320.dp, 380.dp),
|
||||
contentMaxWidth = 520.dp,
|
||||
contentWidthFraction = 0.72f,
|
||||
contentHorizontalPadding = 32.dp,
|
||||
|
|
@ -508,19 +489,6 @@ private fun mobileHeroHeight(
|
|||
return cappedHeight.coerceIn(MOBILE_HERO_MIN_HEIGHT_DP.dp, MOBILE_HERO_MAX_HEIGHT_DP.dp)
|
||||
}
|
||||
|
||||
private fun tabletHeroHeight(
|
||||
maxWidthDp: Float,
|
||||
viewportHeightDp: Float?,
|
||||
widthRatio: Float,
|
||||
minHeight: Dp,
|
||||
maxHeight: Dp,
|
||||
): Dp {
|
||||
val widthDrivenHeight = (maxWidthDp * widthRatio).dp
|
||||
val viewportDrivenHeight = viewportHeightDp?.let { (it * TABLET_HERO_VIEWPORT_RATIO).dp }
|
||||
val baseHeight = maxOf(widthDrivenHeight, viewportDrivenHeight ?: widthDrivenHeight)
|
||||
return baseHeight.coerceIn(minHeight, maxHeight)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun HeroMetaDot() {
|
||||
Box(
|
||||
|
|
|
|||
Loading…
Reference in a new issue