Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,13 @@ internal sealed class TvHeroFactToken {
}

/**
* Full-bleed cinematic hero for the Android TV detail screen. Mirrors the
* tvOS `TVDetailHero` 1:1.
* Full-bleed cinematic hero for the Android TV detail screen. Structurally
* mirrors tvOS `TVDetailHero`.
*
* Layout = a `ZStack(bottomLeading)`: a near-full-viewport backdrop, a
* 4-stop horizontal darkening on the left, a soft vertical fade into the
* rail body at the bottom, then the bottom-anchored editorial + action
* column on the left. The "Starring …" credit floats upper-right as its own
* trailing overlay (tvOS `starringOverlay`), NOT inside the editorial column.
* column on the left.
*
* Apple sizes the hero relative to the viewport (`heroHeight = 980` of a
* 1080-pt canvas ≈ 0.907×), so we compute the height as a fraction of the
Expand All @@ -92,7 +91,6 @@ internal fun TvDetailHero(
overview: String?,
tagline: String?,
factsLine: List<TvHeroFactToken>,
starringText: String?,
directorText: String?,
actions: @Composable () -> Unit,
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -158,36 +156,6 @@ internal fun TvDetailHero(
),
)

// "Starring …" floats in the upper-right of the hero, right-aligned —
// tvOS `.overlay(alignment: .trailing)` + `.padding(.bottom, heroHeight
// * 0.45)` (the bottom padding on the vertically-centered overlay
// pushes the credit into the top-right region). 2-line limit; sized up
// from the raw tvOS ~2x mapping (24pt → 12sp) per design review, with
// maxWidth widened to match so casts don't ellipsize sooner.
starringText?.takeIf { it.isNotBlank() }?.let { line ->
Text(
text = line,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 20.sp,
color = Color.White.copy(alpha = 0.8f),
textAlign = TextAlign.End,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
style = TextStyle(
shadow = Shadow(
color = Color.Black.copy(alpha = 0.55f),
offset = Offset(0f, 2f),
blurRadius = 6f,
),
),
modifier = Modifier
.align(Alignment.CenterEnd)
.padding(end = Spacing.safeArea, bottom = heroHeight * 0.45f)
.widthIn(max = 280.dp),
)
}

// Reserve and pin the action cluster before measuring the editorial
// column. The hero can therefore keep the fixed tvOS viewport framing
// without letting tall copy collapse visible-but-focusable controls.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ internal object TvDetailMetadata {
return tokens
}

fun starringText(detail: ItemDetail): String? {
val names = detail.cast.take(3).map { it.name.trim() }.filter { it.isNotEmpty() }
if (names.isEmpty()) return null
return "Starring ${names.joinToString(", ")}"
}

private fun typeLabel(detail: ItemDetail): String = when {
isAudiobookItemType(detail.type) -> "Audiobook"
else -> when (detail.type.lowercase()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ private fun TvDetailContent(
preferredQuality = state.preferredQuality,
selectedFileId = heroSelectedFileId,
),
starringText = TvDetailMetadata.starringText(detail),
directorText = movieDirectorCredit(detail),
translation = translationSlot,
actions = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.siloserver.silo.tv.ui.screens.detail

import java.io.File
import kotlin.test.Test
import kotlin.test.assertFalse
import kotlin.test.assertTrue

class TvStarringOverlaySourceTest {
private val hero = File(
"src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvDetailHero.kt",
).readText()
private val screen = File(
"src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvItemDetailScreen.kt",
).readText()
private val metadata = File(
"src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvDetailMetadata.kt",
).readText()
private val presentationSources = listOf(hero, screen, metadata)

@Test
fun tvDetailDoesNotDeriveOrRenderDuplicatedStarringOverlay() {
assertFalse(
presentationSources.any { source ->
source.contains("starring", ignoreCase = true)
},
)
}

@Test
fun tvDetailStillRendersTheFullCastSection() {
assertTrue(screen.contains("TvCastCrewSection("))
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}
Loading