This commit is contained in:
ponzischeme89
2026-08-21 11:36:22 +12:00
parent aac8438764
commit 48043dbae2
6 changed files with 131 additions and 12 deletions
@@ -1106,6 +1106,41 @@ fun MediaMetadataPanel(
}
}
/**
* The quiet surface between the focused title details and the scrolling shelves.
*
* The backdrop remains visible through the tint, while the fade at the lower edge keeps
* this integrated with the rows rather than turning it into an opaque panel.
*/
@Composable
internal fun MetadataHero(
item: BaseItem?,
loading: Boolean,
sectionLabel: String,
modifier: Modifier = Modifier,
) {
Box(
modifier = modifier
.clipToBounds()
.background(
Brush.verticalGradient(
0f to MembySurface.copy(alpha = 0.52f),
0.72f to MembySurface.copy(alpha = 0.30f),
1f to Color.Transparent,
),
),
) {
MediaMetadataPanel(
item = item,
loading = loading,
sectionLabel = sectionLabel,
modifier = Modifier
.fillMaxSize()
.padding(start = 36.dp, end = 36.dp, top = 24.dp, bottom = 10.dp),
)
}
}
internal fun metadataPanelContentWidth(availableWidth: Dp, compact: Boolean): Dp =
(availableWidth * if (compact) 0.84f else 0.76f)
.coerceIn(280.dp, 720.dp)
@@ -1804,14 +1839,7 @@ internal fun MediaRow(
// can dispose that item during a focus transfer and make Compose
// release the same pin twice. LazyListState already preserves the
// row position; native TV spatial search safely handles row changes.
// A horizontal lazy list clips along its scroll axis, but focused cards
// also draw from a scaled layer in the vertical axis. Its measured height
// already contains artwork, title and secondary metadata; clip that
// complete unit here so the outgoing card cannot paint into another row.
modifier = Modifier
.fillMaxWidth()
.clipToBounds()
.focusGroup(),
modifier = Modifier.fillMaxWidth().focusGroup(),
) {
itemsIndexed(
row.items,
@@ -285,7 +285,7 @@ internal fun FocusedHomeMetadata(
// whole state: this panel sits beside the hero and redraws on every focus change as
// it is.
val homeContent by homeViewModel.content.collectAsStateWithLifecycle()
MediaMetadataPanel(
MetadataHero(
item = focusedItem,
loading = homeContent.loading.isNotEmpty(),
sectionLabel = sectionLabel,
@@ -165,7 +165,10 @@ internal fun homeHeaderHeight(viewportHeight: Dp, showHero: Boolean): Dp =
if (showHero) {
(viewportHeight * 0.46f).coerceIn(232.dp, 300.dp)
} else {
(viewportHeight * 0.42f).coerceIn(220.dp, 300.dp)
// The focused metadata surface is also the clean upper boundary for shelves as
// they move vertically. About 20dp more coverage at common TV heights keeps a
// departing card's last text line from being exposed without costing another row.
(viewportHeight * 0.46f).coerceIn(240.dp, 320.dp)
}
private val LazyListStateMapSaver: Saver<MutableMap<String, LazyListState>, Any> = listSaver(
@@ -1377,7 +1380,9 @@ internal fun HomeScreen(
sectionLabel = selectedDestination.label,
modifier = Modifier
.height(metadataHeight)
.padding(start = 36.dp, end = 36.dp, top = 24.dp, bottom = 10.dp),
// LazyColumn is drawn later as a sibling. Keep the hero
// above any transient row draw overflow during D-pad moves.
.zIndex(1f),
)
}
AnimatedVisibility(