mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-17 07:21:58 +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()) {
|
BoxWithConstraints(modifier = Modifier.fillMaxSize()) {
|
||||||
val isTablet = maxWidth >= 720.dp
|
val isTablet = maxWidth >= 720.dp
|
||||||
val viewportHeight = maxHeight
|
|
||||||
val contentHorizontalPadding = if (isTablet) 32.dp else 18.dp
|
val contentHorizontalPadding = if (isTablet) 32.dp else 18.dp
|
||||||
val contentMaxWidth = detailTabletContentMaxWidth(maxWidth, isTablet)
|
val contentMaxWidth = detailTabletContentMaxWidth(maxWidth, isTablet)
|
||||||
val cinematicEnabled = metaScreenSettingsUiState.cinematicBackground
|
val cinematicEnabled = metaScreenSettingsUiState.cinematicBackground
|
||||||
|
|
@ -613,7 +612,6 @@ fun MetaDetailsScreen(
|
||||||
DetailHero(
|
DetailHero(
|
||||||
meta = meta,
|
meta = meta,
|
||||||
isTablet = isTablet,
|
isTablet = isTablet,
|
||||||
viewportHeight = viewportHeight,
|
|
||||||
contentMaxWidth = contentMaxWidth,
|
contentMaxWidth = contentMaxWidth,
|
||||||
scrollOffset = scrollState.value,
|
scrollOffset = scrollState.value,
|
||||||
onHeightChanged = { heroHeightPx = it },
|
onHeightChanged = { heroHeightPx = it },
|
||||||
|
|
|
||||||
|
|
@ -25,14 +25,12 @@ import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.graphics.graphicsLayer
|
import androidx.compose.ui.graphics.graphicsLayer
|
||||||
import coil3.compose.AsyncImage
|
import coil3.compose.AsyncImage
|
||||||
import com.nuvio.app.features.details.MetaDetails
|
import com.nuvio.app.features.details.MetaDetails
|
||||||
import com.nuvio.app.features.home.components.homeHeroLayout
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DetailHero(
|
fun DetailHero(
|
||||||
meta: MetaDetails,
|
meta: MetaDetails,
|
||||||
isTablet: Boolean = false,
|
isTablet: Boolean = false,
|
||||||
scrollOffset: Int = 0,
|
scrollOffset: Int = 0,
|
||||||
viewportHeight: Dp? = null,
|
|
||||||
contentMaxWidth: Dp = 560.dp,
|
contentMaxWidth: Dp = 560.dp,
|
||||||
onHeightChanged: (Int) -> Unit = {},
|
onHeightChanged: (Int) -> Unit = {},
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
|
@ -40,10 +38,7 @@ fun DetailHero(
|
||||||
BoxWithConstraints(
|
BoxWithConstraints(
|
||||||
modifier = modifier.fillMaxWidth(),
|
modifier = modifier.fillMaxWidth(),
|
||||||
) {
|
) {
|
||||||
val heroHeight = homeHeroLayout(
|
val heroHeight = detailHeroHeight(maxWidth, isTablet)
|
||||||
maxWidthDp = maxWidth.value,
|
|
||||||
viewportHeightDp = viewportHeight?.value,
|
|
||||||
).heroHeight
|
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
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_VIEWPORT_RATIO = 0.78f
|
||||||
private const val MOBILE_HERO_MIN_HEIGHT_DP = 360f
|
private const val MOBILE_HERO_MIN_HEIGHT_DP = 360f
|
||||||
private const val MOBILE_HERO_MAX_HEIGHT_DP = 760f
|
private const val MOBILE_HERO_MAX_HEIGHT_DP = 760f
|
||||||
private const val TABLET_HERO_VIEWPORT_RATIO = 0.62f
|
|
||||||
|
|
||||||
internal data class HomeHeroLayout(
|
internal data class HomeHeroLayout(
|
||||||
val isTablet: Boolean,
|
val isTablet: Boolean,
|
||||||
|
|
@ -427,13 +426,7 @@ internal fun homeHeroLayout(
|
||||||
when {
|
when {
|
||||||
maxWidthDp >= 1200f -> HomeHeroLayout(
|
maxWidthDp >= 1200f -> HomeHeroLayout(
|
||||||
isTablet = true,
|
isTablet = true,
|
||||||
heroHeight = tabletHeroHeight(
|
heroHeight = (maxWidthDp * 0.42f).dp.coerceIn(360.dp, 440.dp),
|
||||||
maxWidthDp = maxWidthDp,
|
|
||||||
viewportHeightDp = viewportHeightDp,
|
|
||||||
widthRatio = 0.42f,
|
|
||||||
minHeight = 500.dp,
|
|
||||||
maxHeight = 640.dp,
|
|
||||||
),
|
|
||||||
contentMaxWidth = 640.dp,
|
contentMaxWidth = 640.dp,
|
||||||
contentWidthFraction = 0.56f,
|
contentWidthFraction = 0.56f,
|
||||||
contentHorizontalPadding = 56.dp,
|
contentHorizontalPadding = 56.dp,
|
||||||
|
|
@ -443,13 +436,7 @@ internal fun homeHeroLayout(
|
||||||
)
|
)
|
||||||
maxWidthDp >= 840f -> HomeHeroLayout(
|
maxWidthDp >= 840f -> HomeHeroLayout(
|
||||||
isTablet = true,
|
isTablet = true,
|
||||||
heroHeight = tabletHeroHeight(
|
heroHeight = (maxWidthDp * 0.46f).dp.coerceIn(340.dp, 420.dp),
|
||||||
maxWidthDp = maxWidthDp,
|
|
||||||
viewportHeightDp = viewportHeightDp,
|
|
||||||
widthRatio = 0.46f,
|
|
||||||
minHeight = 460.dp,
|
|
||||||
maxHeight = 580.dp,
|
|
||||||
),
|
|
||||||
contentMaxWidth = 560.dp,
|
contentMaxWidth = 560.dp,
|
||||||
contentWidthFraction = 0.62f,
|
contentWidthFraction = 0.62f,
|
||||||
contentHorizontalPadding = 40.dp,
|
contentHorizontalPadding = 40.dp,
|
||||||
|
|
@ -459,13 +446,7 @@ internal fun homeHeroLayout(
|
||||||
)
|
)
|
||||||
maxWidthDp >= 600f -> HomeHeroLayout(
|
maxWidthDp >= 600f -> HomeHeroLayout(
|
||||||
isTablet = true,
|
isTablet = true,
|
||||||
heroHeight = tabletHeroHeight(
|
heroHeight = (maxWidthDp * 0.58f).dp.coerceIn(320.dp, 380.dp),
|
||||||
maxWidthDp = maxWidthDp,
|
|
||||||
viewportHeightDp = viewportHeightDp,
|
|
||||||
widthRatio = 0.58f,
|
|
||||||
minHeight = 420.dp,
|
|
||||||
maxHeight = 520.dp,
|
|
||||||
),
|
|
||||||
contentMaxWidth = 520.dp,
|
contentMaxWidth = 520.dp,
|
||||||
contentWidthFraction = 0.72f,
|
contentWidthFraction = 0.72f,
|
||||||
contentHorizontalPadding = 32.dp,
|
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)
|
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
|
@Composable
|
||||||
private fun HeroMetaDot() {
|
private fun HeroMetaDot() {
|
||||||
Box(
|
Box(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue