Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

test(catalog): complete ownership and golden migration

David Nashash4c7871fd97be
diff --git a/app/src/androidTest/java/com/streamvault/app/ui/PremiumRouteGoldenTest.kt b/app/src/androidTest/java/com/streamvault/app/ui/PremiumRouteGoldenTest.kt
index 0aed765e..55525af3 100644
--- a/app/src/androidTest/java/com/streamvault/app/ui/PremiumRouteGoldenTest.kt
+++ b/app/src/androidTest/java/com/streamvault/app/ui/PremiumRouteGoldenTest.kt
@@ -40,57 +40,6 @@ class PremiumRouteGoldenTest {
@get:Rule
val composeRule = createComposeRule()
- @Test
- fun dashboard_route_matchesGolden() {
- composeRule.setContent {
- StreamVaultTheme {
- Box(
- modifier = Modifier
- .fillMaxSize()
- .testTag("golden")
- ) {
- AppScreenScaffold(
- currentRoute = Routes.HOME,
- onNavigate = {},
- title = "Your Library, Ready",
- subtitle = "Pulse IPTV is active. Jump back into live, continue watching, or browse fresh additions."
- ) {
- Column(verticalArrangement = Arrangement.spacedBy(20.dp)) {
- AppHeroHeader(
- title = "Tonight's Premium Picks",
- subtitle = "One place for live shortcuts, recent progress, and provider health.",
- eyebrow = "Dashboard",
- actions = {
- StatusPill(label = "4K", containerColor = AppColors.Brand)
- StatusPill(label = "Saved", containerColor = AppColors.Warning, contentColor = AppColors.Canvas)
- },
- footer = {
- ContentMetadataStrip(values = listOf("126 live", "18 to resume", "2 alerts"))
- }
- )
- AppSectionHeader(
- title = "Continue Watching",
- subtitle = "Recent live channels, movies, and series kept within reach."
- )
- Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
- MoviePosterCard(movie = TestFixtures.movie, modifier = Modifier.width(160.dp).height(240.dp))
- SeriesPosterCard(series = TestFixtures.series, modifier = Modifier.width(160.dp).height(240.dp))
- LiveChannelRowSurface(
- channel = TestFixtures.liveChannel,
- nowMs = TestFixtures.currentProgram.startTime,
- onClick = {},
- modifier = Modifier.weight(1f)
- )
- }
- }
- }
- }
- }
- }
-
- composeRule.onNodeWithTag("golden").assertAgainstGolden("route_dashboard_default")
- }
-
@Test
fun live_route_matchesGolden() {
composeRule.setContent {
@@ -165,102 +114,6 @@ class PremiumRouteGoldenTest {
composeRule.onNodeWithTag("golden").assertAgainstGolden("route_live_browse")
}
- @Test
- fun movies_route_matchesGolden() {
- composeRule.setContent {
- StreamVaultTheme {
- Box(
- modifier = Modifier
- .fillMaxSize()
- .testTag("golden")
- ) {
- LibraryBrowseScaffold(
- currentRoute = Routes.MOVIES,
- onNavigate = {},
- title = "Movies",
- subtitle = "Curated shelves, fast category jumps, and large-library-safe browsing.",
- railContent = {
- CategoryRailPanel(
- title = "Movie Categories",
- searchValue = "",
- onSearchValueChange = {},
- searchPlaceholder = "Search movie categories"
- ) {
- item { StatusPill(label = "All Library 240", modifier = Modifier.padding(bottom = 8.dp)) }
- item { StatusPill(label = "Top Picks 48", modifier = Modifier.padding(bottom = 8.dp)) }
- item { StatusPill(label = "New Releases 32") }
- }
- },
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
- BrowseHeroPanel(
- title = TestFixtures.vodTitle,
- subtitle = "Prestige movie curation with shared focus styling and premium hierarchy.",
- eyebrow = "Top Picks",
- metadata = listOf("2026", "Thriller", "RTG 8.8"),
- actionLabel = "Play",
- onClick = {}
- )
- Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
- MoviePosterCard(movie = TestFixtures.movie, modifier = Modifier.width(160.dp).height(240.dp))
- MoviePosterCard(
- movie = TestFixtures.movie.copy(id = 101L, name = "Coastline", year = "2025", rating = 8.1f),
- modifier = Modifier.width(160.dp).height(240.dp)
- )
- MoviePosterCard(
- movie = TestFixtures.movie.copy(id = 102L, name = "Northern Lights", year = "2024", rating = 7.9f),
- modifier = Modifier.width(160.dp).height(240.dp)
- )
- }
- LoadMoreCard(label = "Load more titles", onClick = {})
- }
- }
- )
- }
- }
- }
-
- composeRule.onNodeWithTag("golden").assertAgainstGolden("route_movies_landing")
- }
-
- @Test
- fun series_detail_route_matchesGolden() {
- composeRule.setContent {
- StreamVaultTheme {
- Box(
- modifier = Modifier
- .fillMaxSize()
- .testTag("golden")
- ) {
- AppScreenScaffold(
- currentRoute = Routes.SERIES,
- onNavigate = {},
- title = "Series Detail",
- subtitle = "Backdrop hero, metadata, and progress-aware episode rows."
- ) {
- Column(verticalArrangement = Arrangement.spacedBy(18.dp)) {
- BrowseHeroPanel(
- title = TestFixtures.series.name,
- subtitle = "A premium detail surface with season browsing and editorial context.",
- eyebrow = "Trending Series",
- metadata = listOf("Drama", "2026", "RTG 8.5"),
- actionLabel = "Resume",
- onClick = {}
- )
- AppSectionHeader(
- title = "Season 1",
- subtitle = "8 episodes available"
- )
- EpisodeRowCard(episode = TestFixtures.episode)
- }
- }
- }
- }
- }
-
- composeRule.onNodeWithTag("golden").assertAgainstGolden("route_series_detail")
- }
-
@Test
fun saved_guide_and_settings_routes_matchGolden() {
composeRule.setContent {
@@ -347,42 +200,4 @@ class PremiumRouteGoldenTest {
composeRule.onNodeWithTag("golden").assertAgainstGolden("route_saved_guide_settings")
}
- @Test
- fun search_route_matchesGolden() {
- composeRule.setContent {
- StreamVaultTheme {
- Box(
- modifier = Modifier
- .fillMaxSize()
- .testTag("golden")
- ) {
- AppScreenScaffold(
- currentRoute = Routes.SEARCH,
- onNavigate = {},
- title = "Search",
- subtitle = "Unified results across live, movies, and series."
- ) {
- Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
- SearchInput(
- value = "night",
- onValueChange = {},
- placeholder = "Search everything"
- )
- Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
- StatusPill(label = "Live 12")
- StatusPill(label = "Movies 8")
- StatusPill(label = "Series 4")
- }
- Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
- MoviePosterCard(movie = TestFixtures.movie, modifier = Modifier.width(160.dp).height(240.dp))
- SeriesPosterCard(series = TestFixtures.series, modifier = Modifier.width(160.dp).height(240.dp))
- }
- }
- }
- }
- }
- }
-
- composeRule.onNodeWithTag("golden").assertAgainstGolden("route_search_results")
- }
}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/Cards.kt b/app/src/main/java/com/streamvault/app/ui/components/Cards.kt
deleted file mode 100644
index b43485b0..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/Cards.kt
+++ /dev/null
@@ -1,568 +0,0 @@
-package com.streamvault.app.ui.components
-
-import androidx.compose.animation.core.animateFloatAsState
-import androidx.compose.animation.core.tween
-import androidx.compose.foundation.BorderStroke
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.BoxScope
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.fillMaxHeight
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.layout.size
-import androidx.compose.foundation.layout.width
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.material.icons.Icons
-import androidx.compose.material.icons.filled.Star
-import androidx.compose.material3.Icon
-import androidx.compose.material3.LinearProgressIndicator
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.setValue
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.draw.clip
-import androidx.compose.ui.focus.focusRequester
-import androidx.compose.ui.focus.onFocusChanged
-import androidx.compose.ui.graphics.Brush
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.graphics.graphicsLayer
-import androidx.compose.ui.layout.ContentScale
-import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.semantics.contentDescription
-import androidx.compose.ui.semantics.semantics
-import androidx.compose.ui.semantics.stateDescription
-import androidx.compose.ui.text.style.TextOverflow
-import androidx.compose.ui.unit.Dp
-import androidx.compose.ui.unit.dp
-import androidx.tv.material3.Border
-import androidx.tv.material3.ClickableSurfaceDefaults
-import com.streamvault.core.ui.design.LocalAppShapes
-import androidx.tv.material3.MaterialTheme
-import androidx.tv.material3.Surface
-import androidx.tv.material3.Text
-import coil3.compose.AsyncImage
-import com.streamvault.app.R
-import com.streamvault.core.ui.image.rememberCrossfadeImageModel
-import com.streamvault.core.ui.image.ChannelLogoBadge
-import com.streamvault.app.ui.components.shell.MoviePosterCard
-import com.streamvault.app.ui.components.shell.SeriesPosterCard
-import com.streamvault.core.ui.components.shell.StatusPill
-import com.streamvault.app.ui.model.formatVodRatingLabel
-import com.streamvault.domain.playback.archivePlaybackCapability
-import com.streamvault.core.ui.theme.AccentAmber
-import com.streamvault.core.ui.theme.AccentCyan
-import com.streamvault.core.ui.theme.AccentRed
-import com.streamvault.core.ui.theme.FocusBorder
-import com.streamvault.core.ui.theme.GradientOverlayBottom
-import com.streamvault.core.ui.theme.Primary
-import com.streamvault.core.ui.theme.Surface
-import com.streamvault.core.ui.theme.SurfaceElevated
-import com.streamvault.core.ui.theme.SurfaceHighlight
-import com.streamvault.core.ui.theme.TextPrimary
-import com.streamvault.core.ui.theme.TextSecondary
-import com.streamvault.core.ui.theme.TextTertiary
-import com.streamvault.domain.model.Channel
-import com.streamvault.domain.model.Movie
-import com.streamvault.domain.model.Series
-import com.streamvault.core.ui.design.FocusSpec
-import com.streamvault.core.ui.interaction.mouseClickable
-import com.streamvault.core.ui.interaction.rememberTvInteractionSounds
-
-@Composable
-fun FocusableCard(
- onClick: () -> Unit,
- modifier: Modifier = Modifier,
- onLongClick: (() -> Unit)? = null,
- width: Dp = 160.dp,
- height: Dp = 240.dp,
- isReorderMode: Boolean = false,
- isDragging: Boolean = false,
- semanticsDescription: String? = null,
- semanticsStateDescription: String? = null,
- content: @Composable BoxScope.(Boolean) -> Unit
-) {
- var isFocused by remember { mutableStateOf(false) }
- val sounds = rememberTvInteractionSounds()
- val focusRequester = remember { androidx.compose.ui.focus.FocusRequester() }
-
- val scale by animateFloatAsState(
- targetValue = if (isFocused) {
- if (isReorderMode && !isDragging) 1f else FocusSpec.FocusedScale
- } else {
- if (isDragging) FocusSpec.FocusedScale else 1f
- },
- animationSpec = tween(durationMillis = 160),
- label = "cardScale"
- )
-
- Surface(
- onClick = {
- sounds.playSelect()
- onClick()
- },
- onLongClick = onLongClick,
- modifier = modifier
- .focusRequester(focusRequester)
- .width(width)
- .height(height)
- .mouseClickable(
- focusRequester = focusRequester,
- onLongClick = onLongClick,
- onClick = {
- sounds.playSelect()
- onClick()
- }
- )
- .graphicsLayer {
- scaleX = scale
- scaleY = scale
- }
- .semantics(mergeDescendants = true) {
- semanticsDescription?.let { contentDescription = it }
- semanticsStateDescription?.let { stateDescription = it }
- }
- .onFocusChanged {
- if (it.isFocused && !isFocused) {
- sounds.playNavigate()
- }
- isFocused = it.isFocused
- },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),
- scale = ClickableSurfaceDefaults.scale(
- focusedScale = 1f,
- pressedScale = FocusSpec.PressedScale
- ),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = Surface,
- focusedContainerColor = SurfaceHighlight
- ),
- border = ClickableSurfaceDefaults.border(
- border = Border(
- border = BorderStroke(0.dp, Color.Transparent),
- shape = RoundedCornerShape(12.dp)
- ),
- focusedBorder = Border(
- border = BorderStroke(
- width = if (isDragging) 4.dp else FocusSpec.CardBorderWidth,
- color = if (isDragging) AccentAmber else FocusBorder
- ),
- shape = RoundedCornerShape(12.dp)
- )
- )
- ) {
- Box(modifier = Modifier.fillMaxSize()) {
- content(isFocused)
- }
- }
-}
-
-@Composable
-fun ChannelCard(
- channel: Channel,
- nowMs: Long,
- onClick: () -> Unit,
- modifier: Modifier = Modifier,
- onLongClick: (() -> Unit)? = null,
- isLocked: Boolean = false,
- isReorderMode: Boolean = false,
- isDragging: Boolean = false,
- isRecording: Boolean = false,
- isScheduledRecording: Boolean = false
-) {
- val channelCardShape = LocalAppShapes.current.small
- val hasUsableArchive = channel.archivePlaybackCapability().canBuildReplayCandidate
- val channelDescription = buildString {
- append(
- channel.number.takeIf { it > 0 }?.let {
- stringResource(R.string.a11y_channel_with_number, it, channel.name)
- } ?: channel.name
- )
- if (!isLocked) {
- channel.currentProgram?.title?.takeIf { it.isNotBlank() }?.let {
- append(". ")
- append(stringResource(R.string.a11y_now_playing, it))
- }
- if (channel.isFavorite) {
- append(". ")
- append(stringResource(R.string.a11y_favorite))
- }
- if (hasUsableArchive) {
- append(". ")
- append(stringResource(R.string.a11y_catch_up_available))
- }
- }
- }
- FocusableCard(
- onClick = onClick,
- onLongClick = onLongClick,
- modifier = modifier,
- width = 220.dp,
- height = 124.dp,
- isReorderMode = isReorderMode,
- isDragging = isDragging,
- semanticsDescription = channelDescription,
- semanticsStateDescription = if (isLocked) stringResource(R.string.a11y_locked) else null
- ) { isFocused ->
- if (!isLocked) {
- ChannelLogoBadge(
- channelName = channel.name,
- logoUrl = channel.logoUrl,
- shape = channelCardShape,
- textStyle = MaterialTheme.typography.titleMedium,
- textColor = TextSecondary,
- modifier = Modifier.fillMaxSize()
- )
- }
-
- Box(
- modifier = Modifier
- .align(Alignment.BottomCenter)
- .fillMaxWidth()
- .fillMaxHeight(0.55f)
- .background(
- Brush.verticalGradient(
- colors = listOf(Color.Transparent, GradientOverlayBottom)
- )
- )
- )
-
- Column(
- modifier = Modifier
- .align(Alignment.BottomStart)
- .fillMaxWidth()
- .padding(horizontal = 10.dp, vertical = 8.dp),
- verticalArrangement = Arrangement.spacedBy(2.dp)
- ) {
- Text(
- text = if (isLocked) stringResource(R.string.card_locked_channel) else channel.name,
- style = MaterialTheme.typography.titleSmall,
- color = if (isFocused) TextPrimary else TextSecondary,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
-
- if (!isLocked) {
- channel.currentProgram?.let { program ->
- Text(
- text = program.title,
- style = MaterialTheme.typography.labelMedium,
- color = TextTertiary,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
-
- LinearProgressIndicator(
- progress = {
- channelProgressFraction(
- nowMs = nowMs,
- startTimeMs = program.startTime,
- endTimeMs = program.endTime
- )
- },
- modifier = Modifier
- .fillMaxWidth()
- .height(2.dp)
- .clip(RoundedCornerShape(1.dp)),
- color = AccentCyan,
- trackColor = SurfaceHighlight
- )
- }
- }
- }
-
- if (!isLocked) {
- Row(
- modifier = Modifier
- .align(Alignment.TopEnd)
- .padding(6.dp),
- horizontalArrangement = Arrangement.spacedBy(4.dp),
- verticalAlignment = Alignment.CenterVertically
- ) {
- if (channel.isFavorite) {
- Icon(
- imageVector = Icons.Filled.Star,
- contentDescription = null,
- tint = AccentAmber,
- modifier = Modifier.size(14.dp)
- )
- }
- if (channel.errorCount > 0) {
- StatusPill(label = stringResource(R.string.badge_error), containerColor = AccentRed, cornerRadius = 4.dp, horizontalPadding = 6.dp, verticalPadding = 2.dp)
- }
- if (hasUsableArchive) {
- StatusPill(label = stringResource(R.string.badge_catch_up), containerColor = Primary, cornerRadius = 4.dp, horizontalPadding = 6.dp, verticalPadding = 2.dp)
- }
- if (isRecording) {
- StatusPill(label = stringResource(R.string.badge_recording), containerColor = AccentRed, cornerRadius = 4.dp, horizontalPadding = 6.dp, verticalPadding = 2.dp)
- } else if (isScheduledRecording) {
- StatusPill(label = stringResource(R.string.badge_scheduled), containerColor = AccentAmber, cornerRadius = 4.dp, horizontalPadding = 6.dp, verticalPadding = 2.dp)
- }
- StatusPill(
- label = stringResource(R.string.card_live_badge),
- containerColor = AccentRed,
- cornerRadius = 4.dp,
- horizontalPadding = 6.dp,
- verticalPadding = 2.dp
- )
- }
- }
-
- if (isLocked) {
- Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
- StatusPill(label = stringResource(R.string.home_locked_short), containerColor = SurfaceHighlight, cornerRadius = 4.dp, horizontalPadding = 6.dp, verticalPadding = 2.dp)
- }
- }
- }
-}
-
-@Composable
-fun MovieCard(
- movie: Movie,
- onClick: () -> Unit,
- modifier: Modifier = Modifier,
- onLongClick: (() -> Unit)? = null,
- isLocked: Boolean = false,
- showTypeBadge: Boolean = false,
- watchProgress: Float = 0f,
- isReorderMode: Boolean = false,
- isDragging: Boolean = false,
- width: Dp = 136.dp,
- height: Dp = 204.dp
-) {
- val movieDescription = buildString {
- append(movie.name)
- movie.year?.takeIf { it.isNotBlank() }?.let {
- append(". ")
- append(it)
- }
- if (movie.isFavorite && !isLocked) {
- append(". ")
- append(stringResource(R.string.a11y_favorite))
- }
- }
- FocusableCard(
- onClick = onClick,
- onLongClick = onLongClick,
- modifier = modifier,
- width = width,
- height = height,
- isReorderMode = isReorderMode,
- isDragging = isDragging,
- semanticsDescription = movieDescription,
- semanticsStateDescription = if (isLocked) stringResource(R.string.a11y_locked) else null
- ) {
- if (!isLocked) {
- MoviePosterCard(
- movie = movie,
- modifier = Modifier.fillMaxSize()
- )
- } else {
- Box(
- modifier = Modifier
- .fillMaxSize()
- .background(SurfaceElevated),
- contentAlignment = Alignment.Center
- ) {
- StatusPill(
- label = if (isLocked) stringResource(R.string.home_locked_short) else stringResource(R.string.badge_movie),
- containerColor = SurfaceHighlight,
- cornerRadius = 4.dp,
- horizontalPadding = 6.dp,
- verticalPadding = 2.dp
- )
- }
- }
-
- if (watchProgress > 0f && !isLocked) {
- LinearProgressIndicator(
- progress = { watchProgress.coerceIn(0f, 1f) },
- modifier = Modifier
- .align(Alignment.BottomCenter)
- .fillMaxWidth()
- .height(3.dp),
- color = Primary,
- trackColor = Color.Transparent
- )
- }
-
- if (!isLocked) {
- if (showTypeBadge) {
- StatusPill(
- label = stringResource(R.string.badge_movie),
- containerColor = Color.Black.copy(alpha = 0.72f),
- cornerRadius = 4.dp,
- horizontalPadding = 6.dp,
- verticalPadding = 2.dp,
- modifier = Modifier
- .align(Alignment.BottomStart)
- .padding(start = 8.dp, bottom = 8.dp)
- )
- }
-
- if (movie.rating > 0f) {
- Box(
- modifier = Modifier
- .align(Alignment.TopStart)
- .padding(8.dp)
- .background(Color.Black.copy(alpha = 0.6f), RoundedCornerShape(4.dp))
- .padding(horizontal = 6.dp, vertical = 2.dp)
- ) {
- Text(
- text = formatVodRatingLabel(movie.rating),
- style = MaterialTheme.typography.labelSmall,
- color = AccentAmber
- )
- }
- }
-
- if (movie.isFavorite) {
- Box(
- modifier = Modifier
- .align(Alignment.TopEnd)
- .padding(6.dp)
- .background(Color.Black.copy(alpha = 0.55f), RoundedCornerShape(4.dp))
- .padding(4.dp)
- ) {
- Icon(
- imageVector = Icons.Filled.Star,
- contentDescription = null,
- tint = AccentAmber,
- modifier = Modifier.size(12.dp)
- )
- }
- }
- }
- }
-}
-
-@Composable
-fun SeriesCard(
- series: Series,
- onClick: () -> Unit,
- modifier: Modifier = Modifier,
- onLongClick: (() -> Unit)? = null,
- isLocked: Boolean = false,
- showTypeBadge: Boolean = false,
- watchProgress: Float = 0f,
- subtitle: String? = null,
- isReorderMode: Boolean = false,
- isDragging: Boolean = false,
- width: Dp = 136.dp,
- height: Dp = 204.dp
-) {
- val seriesDescription = buildString {
- append(series.name)
- subtitle?.takeIf { it.isNotBlank() }?.let {
- append(". ")
- append(it)
- } ?: series.genre?.takeIf { it.isNotBlank() }?.let {
- append(". ")
- append(it)
- }
- if (series.isFavorite && !isLocked) {
- append(". ")
- append(stringResource(R.string.a11y_favorite))
- }
- }
- FocusableCard(
- onClick = onClick,
- onLongClick = onLongClick,
- modifier = modifier,
- width = width,
- height = height,
- isReorderMode = isReorderMode,
- isDragging = isDragging,
- semanticsDescription = seriesDescription,
- semanticsStateDescription = if (isLocked) stringResource(R.string.a11y_locked) else null
- ) {
- if (!isLocked) {
- SeriesPosterCard(
- series = series,
- modifier = Modifier.fillMaxSize()
- )
- } else {
- Box(
- modifier = Modifier
- .fillMaxSize()
- .background(SurfaceElevated),
- contentAlignment = Alignment.Center
- ) {
- StatusPill(
- label = if (isLocked) stringResource(R.string.home_locked_short) else stringResource(R.string.badge_series),
- containerColor = SurfaceHighlight,
- cornerRadius = 4.dp,
- horizontalPadding = 6.dp,
- verticalPadding = 2.dp
- )
- }
- }
-
- if (watchProgress > 0f && !isLocked) {
- LinearProgressIndicator(
- progress = { watchProgress.coerceIn(0f, 1f) },
- modifier = Modifier
- .align(Alignment.BottomCenter)
- .fillMaxWidth()
- .height(3.dp),
- color = Primary,
- trackColor = Color.Transparent
- )
- }
-
- if (!isLocked) {
- if (showTypeBadge) {
- StatusPill(
- label = stringResource(R.string.badge_series),
- containerColor = Color.Black.copy(alpha = 0.72f),
- cornerRadius = 4.dp,
- horizontalPadding = 6.dp,
- verticalPadding = 2.dp,
- modifier = Modifier
- .align(Alignment.BottomStart)
- .padding(start = 8.dp, bottom = 8.dp)
- )
- }
-
- if (series.rating > 0f) {
- Box(
- modifier = Modifier
- .align(Alignment.TopStart)
- .padding(8.dp)
- .background(Color.Black.copy(alpha = 0.6f), RoundedCornerShape(4.dp))
- .padding(horizontal = 6.dp, vertical = 2.dp)
- ) {
- Text(
- text = formatVodRatingLabel(series.rating),
- style = MaterialTheme.typography.labelSmall,
- color = AccentAmber
- )
- }
- }
-
- if (series.isFavorite) {
- Box(
- modifier = Modifier
- .align(Alignment.TopEnd)
- .padding(6.dp)
- .background(Color.Black.copy(alpha = 0.55f), RoundedCornerShape(4.dp))
- .padding(4.dp)
- ) {
- Icon(
- imageVector = Icons.Filled.Star,
- contentDescription = null,
- tint = AccentAmber,
- modifier = Modifier.size(12.dp)
- )
- }
- }
- }
- }
-}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt b/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt
deleted file mode 100644
index 656634c5..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt
+++ /dev/null
@@ -1,163 +0,0 @@
-package com.streamvault.app.ui.components
-
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.BorderStroke
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.foundation.lazy.LazyRow
-import androidx.compose.foundation.lazy.items
-import androidx.compose.material.icons.Icons
-import androidx.compose.material.icons.filled.PushPin
-import androidx.compose.material.icons.outlined.PushPin
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.remember
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.ExperimentalComposeUiApi
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.focus.FocusRequester
-import androidx.compose.ui.focus.focusRestorer
-import androidx.compose.ui.focus.focusRequester
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.unit.dp
-import androidx.compose.ui.res.stringResource
-import androidx.tv.material3.Border
-import androidx.tv.material3.ClickableSurfaceDefaults
-import androidx.tv.material3.Icon
-import androidx.tv.material3.MaterialTheme
-import androidx.tv.material3.Surface
-import androidx.tv.material3.Text
-import com.streamvault.app.R
-import com.streamvault.core.ui.components.shell.AppSectionHeader
-import com.streamvault.core.ui.theme.FocusBorder
-import com.streamvault.core.ui.theme.OnSurface
-import com.streamvault.core.ui.theme.Primary
-import com.streamvault.core.ui.theme.SurfaceElevated
-import com.streamvault.core.ui.theme.SurfaceHighlight
-import com.streamvault.core.ui.interaction.mouseClickable
-
-// ׳’ג€ג‚¬׳’ג€ג‚¬ Netflix-style horizontal category row ׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬
-
-@OptIn(ExperimentalComposeUiApi::class)
-@Composable
-fun <T : Any> CategoryRow(
- title: String,
- items: List<T>,
- modifier: Modifier = Modifier,
- onSeeAll: (() -> Unit)? = null,
- onPinToggle: (() -> Unit)? = null,
- isPinned: Boolean = false,
- keySelector: (T) -> Any,
- contentTypeSelector: ((T) -> Any?)? = null,
- itemContent: @Composable (T) -> Unit
-) {
- val resolvedContentTypeSelector: (T) -> Any? = contentTypeSelector ?: { null }
-
- Column(
- modifier = modifier
- .fillMaxWidth()
- .suppressParentVerticalScroll()
- ) {
- if (onSeeAll != null) {
- val seeAllFocusRequester = remember { FocusRequester() }
- val pinFocusRequester = remember { FocusRequester() }
- Column(
- modifier = Modifier
- .fillMaxWidth()
- .padding(start = 20.dp, end = 20.dp, top = 14.dp, bottom = 6.dp),
- verticalArrangement = Arrangement.spacedBy(8.dp)
- ) {
- Row(
- modifier = Modifier.fillMaxWidth(),
- horizontalArrangement = Arrangement.spacedBy(8.dp),
- verticalAlignment = Alignment.CenterVertically
- ) {
- AppSectionHeader(title = title, modifier = Modifier.weight(1f))
- Surface(
- onClick = onSeeAll,
- modifier = Modifier
- .focusRequester(seeAllFocusRequester)
- .mouseClickable(
- focusRequester = seeAllFocusRequester,
- onClick = onSeeAll
- ),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = SurfaceElevated,
- focusedContainerColor = SurfaceHighlight,
- contentColor = Primary,
- focusedContentColor = OnSurface
- ),
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),
- border = ClickableSurfaceDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(2.dp, FocusBorder),
- shape = RoundedCornerShape(999.dp)
- )
- )
- ) {
- Text(
- text = stringResource(R.string.category_see_all),
- modifier = Modifier.padding(horizontal = 12.dp, vertical = 7.dp),
- style = MaterialTheme.typography.labelMedium
- )
- }
- if (onPinToggle != null) {
- Surface(
- onClick = onPinToggle,
- modifier = Modifier
- .focusRequester(pinFocusRequester)
- .mouseClickable(
- focusRequester = pinFocusRequester,
- onClick = onPinToggle
- ),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (isPinned) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = SurfaceHighlight,
- contentColor = if (isPinned) Primary else OnSurface,
- focusedContentColor = OnSurface
- ),
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),
- border = ClickableSurfaceDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(2.dp, FocusBorder),
- shape = RoundedCornerShape(999.dp)
- )
- )
- ) {
- Icon(
- imageVector = if (isPinned) Icons.Filled.PushPin else Icons.Outlined.PushPin,
- contentDescription = if (isPinned) stringResource(R.string.category_unpin) else stringResource(R.string.category_pin),
- modifier = Modifier.padding(8.dp),
- tint = if (isPinned) Primary else OnSurface
- )
- }
- }
- }
- }
- } else {
- AppSectionHeader(
- title = title,
- modifier = Modifier
- .fillMaxWidth()
- .padding(start = 20.dp, end = 20.dp, top = 14.dp, bottom = 6.dp)
- )
- }
-
- LazyRow(
- modifier = Modifier.focusRestorer(),
- contentPadding = PaddingValues(horizontal = 20.dp, vertical = 10.dp),
- horizontalArrangement = Arrangement.spacedBy(8.dp)
- ) {
- items(
- items = items,
- key = keySelector,
- contentType = resolvedContentTypeSelector
- ) { item ->
- itemContent(item)
- }
- }
- }
-}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/ChannelProgressTicker.kt b/app/src/main/java/com/streamvault/app/ui/components/ChannelProgressTicker.kt
deleted file mode 100644
index fdf579b1..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/ChannelProgressTicker.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.streamvault.app.ui.components
-
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.SupervisorJob
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.flow.SharingStarted
-import kotlinx.coroutines.flow.StateFlow
-import kotlinx.coroutines.flow.flow
-import kotlinx.coroutines.flow.stateIn
-
-internal object ChannelProgressTicker {
- private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
-
- val nowMs: StateFlow<Long> = flow {
- while (true) {
- emit(System.currentTimeMillis())
- delay(30_000L)
- }
- }.stateIn(
- scope = scope,
- started = SharingStarted.WhileSubscribed(stopTimeoutMillis = 30_000L),
- initialValue = System.currentTimeMillis()
- )
-}
-
-internal fun channelProgressFraction(
- nowMs: Long,
- startTimeMs: Long,
- endTimeMs: Long
-): Float {
- val durationMs = endTimeMs - startTimeMs
- if (durationMs <= 0L) return 0f
-
- return ((nowMs - startTimeMs).toFloat() / durationMs.toFloat()).coerceIn(0f, 1f)
-}
-
diff --git a/app/src/main/java/com/streamvault/app/ui/components/ContinueWatchingRow.kt b/app/src/main/java/com/streamvault/app/ui/components/ContinueWatchingRow.kt
deleted file mode 100644
index c094160c..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/ContinueWatchingRow.kt
+++ /dev/null
@@ -1,182 +0,0 @@
-package com.streamvault.app.ui.components
-
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.fillMaxHeight
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.lazy.LazyRow
-import androidx.compose.foundation.lazy.items
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.material3.LinearProgressIndicator
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.ExperimentalComposeUiApi
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.draw.clip
-import androidx.compose.ui.focus.focusRestorer
-import androidx.compose.ui.graphics.Brush
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.layout.ContentScale
-import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.text.style.TextOverflow
-import androidx.compose.ui.unit.dp
-import androidx.tv.material3.MaterialTheme
-import androidx.tv.material3.Text
-import coil3.compose.AsyncImage
-import com.streamvault.app.R
-import com.streamvault.core.ui.image.rememberCrossfadeImageModel
-import com.streamvault.core.ui.theme.AccentCyan
-import com.streamvault.core.ui.theme.GradientOverlayBottom
-import com.streamvault.core.ui.theme.SurfaceElevated
-import com.streamvault.core.ui.theme.TextPrimary
-import com.streamvault.core.ui.theme.TextSecondary
-import com.streamvault.core.ui.theme.TextTertiary
-import com.streamvault.domain.model.ContentType
-import com.streamvault.domain.model.PlaybackHistory
-
-@OptIn(ExperimentalComposeUiApi::class)
-@Composable
-fun ContinueWatchingRow(
- title: String? = null,
- items: List<PlaybackHistory>,
- onItemClick: (PlaybackHistory) -> Unit,
- modifier: Modifier = Modifier
-) {
- if (items.isEmpty()) return
-
- Column(modifier = modifier.fillMaxWidth().suppressParentVerticalScroll()) {
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .padding(start = 20.dp, end = 20.dp, top = 14.dp, bottom = 6.dp),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically
- ) {
- Text(
- text = title ?: stringResource(R.string.continue_watching_title),
- style = MaterialTheme.typography.titleMedium,
- color = TextPrimary
- )
- }
-
- LazyRow(
- modifier = Modifier.focusRestorer(),
- contentPadding = PaddingValues(horizontal = 20.dp),
- horizontalArrangement = Arrangement.spacedBy(8.dp)
- ) {
- items(
- items = items,
- key = { it.id },
- contentType = { it.contentType }
- ) { history ->
- ContinueWatchingTile(history = history, onClick = { onItemClick(history) })
- }
- }
- }
-}
-
-@Composable
-private fun ContinueWatchingTile(
- history: PlaybackHistory,
- onClick: () -> Unit
-) {
- val progress = if (history.totalDurationMs > 0) {
- (history.resumePositionMs.toFloat() / history.totalDurationMs).coerceIn(0f, 1f)
- } else {
- 0f
- }
-
- FocusableCard(
- onClick = onClick,
- width = 208.dp,
- height = 117.dp
- ) {
- Box(
- modifier = Modifier
- .fillMaxSize()
- .background(SurfaceElevated),
- contentAlignment = Alignment.Center
- ) {
- // Fallback always visible; covered by AsyncImage on successful load
- Text(
- text = when (history.contentType) {
- ContentType.LIVE -> stringResource(R.string.card_live_badge)
- ContentType.MOVIE,
- ContentType.VOD -> stringResource(R.string.nav_vod)
- ContentType.SERIES, ContentType.SERIES_EPISODE -> stringResource(R.string.nav_series)
- },
- style = MaterialTheme.typography.titleLarge,
- color = TextSecondary
- )
- if (!history.posterUrl.isNullOrBlank()) {
- AsyncImage(
- model = rememberCrossfadeImageModel(history.posterUrl),
- contentDescription = history.title,
- modifier = Modifier
- .fillMaxSize()
- .clip(RoundedCornerShape(10.dp)),
- contentScale = ContentScale.Crop
- )
- }
- }
-
- Box(
- modifier = Modifier
- .align(Alignment.BottomCenter)
- .fillMaxWidth()
- .fillMaxHeight(0.55f)
- .background(Brush.verticalGradient(listOf(Color.Transparent, GradientOverlayBottom)))
- )
-
- Column(
- modifier = Modifier
- .align(Alignment.BottomStart)
- .fillMaxWidth()
- .padding(horizontal = 10.dp, vertical = if (progress > 0f) 10.dp else 6.dp),
- verticalArrangement = Arrangement.spacedBy(2.dp)
- ) {
- Text(
- text = history.title,
- style = MaterialTheme.typography.titleSmall,
- color = TextPrimary,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- if (
- history.contentType == ContentType.SERIES_EPISODE &&
- history.seasonNumber != null &&
- history.episodeNumber != null
- ) {
- Text(
- text = stringResource(
- R.string.continue_watching_season_episode,
- history.seasonNumber!!,
- history.episodeNumber!!
- ),
- style = MaterialTheme.typography.labelMedium,
- color = TextTertiary,
- maxLines = 1
- )
- }
- }
-
- if (progress > 0f) {
- LinearProgressIndicator(
- progress = { progress },
- modifier = Modifier
- .align(Alignment.BottomCenter)
- .fillMaxWidth()
- .height(3.dp),
- color = AccentCyan,
- trackColor = Color.Transparent
- )
- }
- }
-}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/FocusedMarqueeText.kt b/app/src/main/java/com/streamvault/app/ui/components/FocusedMarqueeText.kt
deleted file mode 100644
index 89de1df0..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/FocusedMarqueeText.kt
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.streamvault.app.ui.components
-
-import androidx.compose.foundation.basicMarquee
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.CompositionLocalProvider
-import androidx.compose.runtime.remember
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.platform.LocalLayoutDirection
-import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.style.TextOverflow
-import androidx.compose.ui.unit.LayoutDirection
-import androidx.compose.ui.unit.dp
-import androidx.tv.material3.Text
-
-@Composable
-fun FocusedMarqueeText(
- text: String,
- isFocused: Boolean,
- modifier: Modifier = Modifier,
- style: TextStyle = TextStyle.Default,
- color: Color = Color.Unspecified,
- maxLines: Int = 1
-) {
- val ambientLayoutDirection = LocalLayoutDirection.current
- val marqueeLayoutDirection = remember(text, ambientLayoutDirection) {
- when {
- hasMixedDirectionalText(text) -> LayoutDirection.Ltr
- hasStrongRtlText(text) -> LayoutDirection.Rtl
- else -> ambientLayoutDirection
- }
- }
-
- CompositionLocalProvider(LocalLayoutDirection provides marqueeLayoutDirection) {
- Text(
- text = text,
- style = style,
- color = color,
- maxLines = maxLines,
- overflow = if (isFocused) TextOverflow.Clip else TextOverflow.Ellipsis,
- modifier = modifier.then(
- if (isFocused) {
- Modifier.basicMarquee(
- iterations = Int.MAX_VALUE,
- initialDelayMillis = 900,
- repeatDelayMillis = 1200,
- velocity = 24.dp
- )
- } else {
- Modifier
- }
- )
- )
- }
-}
-
-private fun hasMixedDirectionalText(text: String): Boolean {
- var hasStrongLtr = false
- var hasStrongRtl = false
- text.forEach { char ->
- when (Character.getDirectionality(char)) {
- Character.DIRECTIONALITY_LEFT_TO_RIGHT -> hasStrongLtr = true
- Character.DIRECTIONALITY_RIGHT_TO_LEFT,
- Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC -> hasStrongRtl = true
- }
- if (hasStrongLtr && hasStrongRtl) {
- return true
- }
- }
- return false
-}
-
-private fun hasStrongRtlText(text: String): Boolean {
- var hasStrongRtl = false
- text.forEach { char ->
- when (Character.getDirectionality(char)) {
- Character.DIRECTIONALITY_LEFT_TO_RIGHT -> return false
- Character.DIRECTIONALITY_RIGHT_TO_LEFT,
- Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC -> hasStrongRtl = true
- }
- }
- return hasStrongRtl
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/streamvault/app/ui/components/ReorderTopBar.kt b/app/src/main/java/com/streamvault/app/ui/components/ReorderTopBar.kt
deleted file mode 100644
index b6ac6bcd..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/ReorderTopBar.kt
+++ /dev/null
@@ -1,123 +0,0 @@
-package com.streamvault.app.ui.components
-
-import androidx.compose.foundation.BorderStroke
-import androidx.compose.animation.AnimatedVisibility
-import androidx.compose.animation.slideInVertically
-import androidx.compose.animation.slideOutVertically
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.*
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Brush
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.unit.dp
-import androidx.compose.ui.res.stringResource
-import androidx.tv.material3.*
-import com.streamvault.app.R
-import com.streamvault.core.ui.design.FocusSpec
-import com.streamvault.core.ui.theme.FocusBorder
-import com.streamvault.core.ui.theme.OnSurface
-import com.streamvault.core.ui.theme.Primary
-import com.streamvault.core.ui.theme.SurfaceElevated
-import com.streamvault.core.ui.theme.TextPrimary
-import com.streamvault.core.ui.theme.TextSecondary
-import com.streamvault.core.ui.interaction.TvClickableSurface
-import com.streamvault.core.ui.interaction.TvButton
-import com.streamvault.core.ui.interaction.TvIconButton
-
-@Composable
-fun ReorderTopBar(
- categoryName: String,
- onSave: () -> Unit,
- onCancel: () -> Unit,
- visible: Boolean = true,
- subtitle: String? = null,
- modifier: Modifier = Modifier
-) {
- AnimatedVisibility(
- visible = visible,
- enter = slideInVertically(initialOffsetY = { -it }),
- exit = slideOutVertically(targetOffsetY = { -it }),
- modifier = modifier
- .fillMaxWidth()
- .padding(bottom = 20.dp)
- ) {
- Surface(
- shape = RoundedCornerShape(24.dp),
- colors = SurfaceDefaults.colors(containerColor = SurfaceElevated)
- ) {
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .background(
- Brush.horizontalGradient(
- listOf(
- Primary.copy(alpha = 0.08f),
- Color.Transparent
- )
- )
- )
- .padding(horizontal = 24.dp, vertical = 18.dp),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically
- ) {
- Column(
- modifier = Modifier.weight(1f),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = stringResource(R.string.label_reordering, categoryName),
- style = MaterialTheme.typography.titleLarge,
- color = TextPrimary
- )
- subtitle?.takeIf { it.isNotBlank() }?.let {
- Text(
- text = it,
- style = MaterialTheme.typography.bodySmall,
- color = TextSecondary
- )
- }
- }
- Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {
- TvButton(
- onClick = onCancel,
- colors = ButtonDefaults.colors(
- containerColor = MaterialTheme.colorScheme.surfaceVariant,
- contentColor = OnSurface,
- focusedContainerColor = MaterialTheme.colorScheme.surface,
- focusedContentColor = OnSurface
- ),
- border = ButtonDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(FocusSpec.BorderWidth, FocusBorder)
- )
- ),
- scale = ButtonDefaults.scale(focusedScale = FocusSpec.FocusedScale)
- ) {
- Text(stringResource(R.string.action_cancel), modifier = Modifier.padding(horizontal = 8.dp))
- }
-
- TvButton(
- onClick = onSave,
- colors = ButtonDefaults.colors(
- containerColor = Primary,
- contentColor = Color.White,
- focusedContainerColor = Primary.copy(alpha = 0.88f),
- focusedContentColor = Color.White
- ),
- border = ButtonDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(FocusSpec.BorderWidth, FocusBorder)
- )
- ),
- scale = ButtonDefaults.scale(focusedScale = FocusSpec.FocusedScale)
- ) {
- Text(stringResource(R.string.action_save_order), modifier = Modifier.padding(horizontal = 8.dp))
- }
- }
- }
- }
- }
-}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/RowScrollFix.kt b/app/src/main/java/com/streamvault/app/ui/components/RowScrollFix.kt
deleted file mode 100644
index ac707ea7..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/RowScrollFix.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-@file:Suppress("DEPRECATION")
-
-package com.streamvault.app.ui.components
-
-import androidx.compose.foundation.ExperimentalFoundationApi
-import androidx.compose.foundation.relocation.BringIntoViewResponder
-import androidx.compose.foundation.relocation.bringIntoViewResponder
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableFloatStateOf
-import androidx.compose.runtime.setValue
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.composed
-import androidx.compose.ui.geometry.Rect
-import androidx.compose.ui.layout.onSizeChanged
-
-/**
- * Prevents a parent scrollable (e.g. LazyColumn) from micro-scrolling vertically
- * when D-pad focus moves between children of an inner horizontal row (e.g. LazyRow).
- *
- * Works by replacing the per-card BringIntoView rect with the full height of this
- * container, so the parent only scrolls to ensure the whole row section is visible.
- */
-@OptIn(ExperimentalFoundationApi::class)
-fun Modifier.suppressParentVerticalScroll(): Modifier = composed {
- var height by mutableFloatStateOf(0f)
-
- this
- .onSizeChanged { height = it.height.toFloat() }
- .bringIntoViewResponder(object : BringIntoViewResponder {
- override fun calculateRectForParent(localRect: Rect): Rect =
- Rect(localRect.left, 0f, localRect.right, height)
-
- override suspend fun bringChildIntoView(localRect: () -> Rect?) {
- // No-op: horizontal scrolling is handled by the inner LazyRow.
- }
- })
-}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryContextCard.kt b/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryContextCard.kt
deleted file mode 100644
index f2eded64..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryContextCard.kt
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.streamvault.app.ui.components
-
-import androidx.compose.foundation.BorderStroke
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.layout.Spacer
-import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Brush
-import androidx.compose.ui.text.style.TextOverflow
-import androidx.compose.ui.unit.dp
-import androidx.compose.ui.res.stringResource
-import androidx.tv.material3.Button
-import androidx.tv.material3.ButtonDefaults
-import androidx.tv.material3.Border
-import androidx.tv.material3.MaterialTheme
-import androidx.tv.material3.Surface
-import androidx.tv.material3.SurfaceDefaults
-import androidx.tv.material3.Text
-import com.streamvault.app.R
-import com.streamvault.core.ui.design.FocusSpec
-import com.streamvault.core.ui.theme.FocusBorder
-import com.streamvault.core.ui.theme.OnSurface
-import com.streamvault.core.ui.theme.OnSurfaceDim
-import com.streamvault.core.ui.theme.Primary
-import com.streamvault.core.ui.theme.SurfaceElevated
-import com.streamvault.core.ui.interaction.mouseClickable
-
-@Composable
-fun SavedCategoryContextCard(
- categoryName: String,
- itemCount: Int,
- onManageClick: () -> Unit,
- onBrowseAllClick: () -> Unit,
- modifier: Modifier = Modifier
-) {
- Surface(
- modifier = modifier.fillMaxWidth(),
- shape = RoundedCornerShape(18.dp),
- colors = SurfaceDefaults.colors(
- containerColor = SurfaceElevated
- )
- ) {
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .background(
- Brush.horizontalGradient(
- listOf(
- Primary.copy(alpha = 0.10f),
- Primary.copy(alpha = 0.02f)
- )
- )
- )
- .padding(horizontal = 18.dp, vertical = 14.dp),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.Top
- ) {
- Column(
- modifier = Modifier.weight(1f),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = stringResource(R.string.library_saved_active_title),
- style = MaterialTheme.typography.labelSmall,
- color = Primary
- )
- Text(
- text = categoryName,
- style = MaterialTheme.typography.titleMedium,
- color = OnSurface,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- Text(
- text = stringResource(R.string.library_saved_active_summary, itemCount),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim,
- maxLines = 1
- )
- Spacer(modifier = Modifier.height(2.dp))
- Text(
- text = stringResource(R.string.library_saved_manage_hint),
- style = MaterialTheme.typography.labelSmall,
- color = OnSurfaceDim
- )
- }
-
- Row(
- horizontalArrangement = Arrangement.spacedBy(8.dp),
- verticalAlignment = Alignment.CenterVertically
- ) {
- Button(
- onClick = onManageClick,
- modifier = Modifier.mouseClickable(onClick = onManageClick),
- colors = ButtonDefaults.colors(
- containerColor = Primary.copy(alpha = 0.92f),
- focusedContainerColor = Primary,
- focusedContentColor = androidx.compose.ui.graphics.Color.White
- ),
- border = ButtonDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(FocusSpec.BorderWidth, FocusBorder)
- )
- ),
- scale = ButtonDefaults.scale(focusedScale = FocusSpec.FocusedScale)
- ) {
- Text(stringResource(R.string.library_saved_manage_action))
- }
- Button(
- onClick = onBrowseAllClick,
- modifier = Modifier.mouseClickable(onClick = onBrowseAllClick),
- colors = ButtonDefaults.colors(
- containerColor = SurfaceElevated.copy(alpha = 0.78f),
- contentColor = OnSurface,
- focusedContainerColor = SurfaceElevated,
- focusedContentColor = OnSurface
- ),
- border = ButtonDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(FocusSpec.BorderWidth, FocusBorder)
- )
- ),
- scale = ButtonDefaults.scale(focusedScale = FocusSpec.FocusedScale)
- ) {
- Text(stringResource(R.string.library_browse_all))
- }
- }
- }
- }
-}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryShortcutsRow.kt b/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryShortcutsRow.kt
deleted file mode 100644
index aa7a6510..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryShortcutsRow.kt
+++ /dev/null
@@ -1,209 +0,0 @@
-package com.streamvault.app.ui.components
-
-import androidx.compose.foundation.BorderStroke
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.layout.width
-import androidx.compose.foundation.lazy.LazyRow
-import androidx.compose.foundation.lazy.items
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.ExperimentalComposeUiApi
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.focus.focusRestorer
-import androidx.compose.ui.platform.LocalConfiguration
-import androidx.compose.ui.text.style.TextOverflow
-import androidx.compose.ui.unit.dp
-import androidx.compose.ui.res.stringResource
-import androidx.tv.material3.Border
-import androidx.tv.material3.ClickableSurfaceDefaults
-import androidx.tv.material3.MaterialTheme
-import androidx.tv.material3.Surface
-import androidx.tv.material3.SurfaceDefaults
-import androidx.tv.material3.Text
-import com.streamvault.app.R
-import com.streamvault.core.ui.design.FocusSpec
-import com.streamvault.core.ui.theme.FocusBorder
-import com.streamvault.core.ui.theme.OnSurface
-import com.streamvault.core.ui.theme.OnSurfaceDim
-import com.streamvault.core.ui.theme.Primary
-import com.streamvault.core.ui.theme.SurfaceElevated
-import com.streamvault.core.ui.interaction.mouseClickable
-
-data class SavedCategoryShortcut(
- val name: String,
- val count: Int
-)
-
-@OptIn(ExperimentalComposeUiApi::class)
-@Composable
-fun SavedCategoryShortcutsRow(
- title: String,
- subtitle: String,
- emptyHint: String,
- shortcuts: List<SavedCategoryShortcut>,
- managementHint: String? = null,
- primaryShortcutLabel: String? = null,
- isPrimaryShortcutSelected: Boolean = false,
- onPrimaryShortcutClick: (() -> Unit)? = null,
- selectedShortcutName: String? = null,
- onShortcutLongClick: ((String) -> Unit)? = null,
- onShortcutClick: (String) -> Unit,
- modifier: Modifier = Modifier
-) {
- val screenWidth = LocalConfiguration.current.screenWidthDp.dp
- val shortcutWidth = if (screenWidth < 700.dp) 156.dp else 192.dp
-
- Column(modifier = modifier.fillMaxWidth()) {
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .padding(start = 20.dp, end = 20.dp, top = 12.dp, bottom = 6.dp),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically
- ) {
- Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {
- Text(
- text = title,
- style = MaterialTheme.typography.titleMedium,
- color = OnSurface
- )
- Text(
- text = subtitle,
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- if (!managementHint.isNullOrBlank()) {
- Text(
- text = managementHint,
- style = MaterialTheme.typography.labelSmall,
- color = Primary.copy(alpha = 0.85f)
- )
- }
- }
- }
-
- if (shortcuts.isEmpty()) {
- Surface(
- modifier = Modifier
- .fillMaxWidth()
- .padding(horizontal = 20.dp),
- shape = RoundedCornerShape(14.dp),
- colors = SurfaceDefaults.colors(containerColor = SurfaceElevated)
- ) {
- Text(
- text = emptyHint,
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim,
- maxLines = 2,
- overflow = TextOverflow.Ellipsis,
- modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp)
- )
- }
- return
- }
-
- LazyRow(
- modifier = Modifier.focusRestorer(),
- contentPadding = PaddingValues(horizontal = 20.dp),
- horizontalArrangement = Arrangement.spacedBy(8.dp)
- ) {
- if (primaryShortcutLabel != null && onPrimaryShortcutClick != null) {
- item(key = "primary_shortcut") {
- Surface(
- onClick = onPrimaryShortcutClick,
- modifier = Modifier.width(shortcutWidth).mouseClickable(onClick = onPrimaryShortcutClick),
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (isPrimaryShortcutSelected) {
- Primary.copy(alpha = 0.18f)
- } else {
- SurfaceElevated
- },
- focusedContainerColor = Primary.copy(alpha = 0.22f),
- contentColor = if (isPrimaryShortcutSelected) Primary else OnSurface,
- focusedContentColor = OnSurface
- ),
- border = ClickableSurfaceDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(FocusSpec.BorderWidth, FocusBorder),
- shape = RoundedCornerShape(14.dp)
- )
- ),
- scale = ClickableSurfaceDefaults.scale(focusedScale = FocusSpec.FocusedScale)
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 14.dp, vertical = 12.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = primaryShortcutLabel,
- style = MaterialTheme.typography.titleSmall,
- color = if (isPrimaryShortcutSelected) Primary else OnSurface,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- Text(
- text = stringResource(R.string.library_saved_primary_hint),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim,
- maxLines = 1
- )
- }
- }
- }
- }
- items(items = shortcuts, key = { it.name }) { shortcut ->
- val isSelected = shortcut.name == selectedShortcutName
- Surface(
- onClick = { onShortcutClick(shortcut.name) },
- onLongClick = onShortcutLongClick?.let { handler ->
- { handler(shortcut.name) }
- },
- modifier = Modifier.width(shortcutWidth).mouseClickable(
- onClick = { onShortcutClick(shortcut.name) },
- onLongClick = onShortcutLongClick?.let { handler -> { handler(shortcut.name) } }
- ),
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (isSelected) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.22f),
- contentColor = if (isSelected) Primary else OnSurface,
- focusedContentColor = OnSurface
- ),
- border = ClickableSurfaceDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(FocusSpec.BorderWidth, FocusBorder),
- shape = RoundedCornerShape(14.dp)
- )
- ),
- scale = ClickableSurfaceDefaults.scale(focusedScale = FocusSpec.FocusedScale)
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 14.dp, vertical = 12.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = shortcut.name,
- style = MaterialTheme.typography.titleSmall,
- color = if (isSelected) Primary else OnSurface,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- Text(
- text = stringResource(R.string.library_saved_items_count, shortcut.count),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim,
- maxLines = 1
- )
- }
- }
- }
- }
- }
-}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/SelectionChipRow.kt b/app/src/main/java/com/streamvault/app/ui/components/SelectionChipRow.kt
deleted file mode 100644
index 063b856e..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/SelectionChipRow.kt
+++ /dev/null
@@ -1,188 +0,0 @@
-package com.streamvault.app.ui.components
-
-import androidx.compose.foundation.BorderStroke
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.lazy.LazyRow
-import androidx.compose.foundation.lazy.items
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.setValue
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.focus.FocusRequester
-import androidx.compose.ui.focus.onFocusChanged
-import androidx.compose.ui.focus.focusRequester
-import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.style.TextOverflow
-import androidx.compose.ui.unit.dp
-import androidx.tv.material3.Border
-import androidx.tv.material3.ClickableSurfaceDefaults
-import androidx.tv.material3.MaterialTheme
-import androidx.tv.material3.Surface
-import androidx.tv.material3.Text
-import com.streamvault.core.ui.theme.FocusBorder
-import com.streamvault.core.ui.theme.OnSurface
-import com.streamvault.core.ui.theme.OnSurfaceDim
-import com.streamvault.core.ui.theme.Primary
-import com.streamvault.core.ui.theme.SurfaceElevated
-import com.streamvault.core.ui.theme.SurfaceHighlight
-import com.streamvault.core.ui.interaction.mouseClickable
-import com.streamvault.core.ui.interaction.rememberTvInteractionSounds
-
-data class SelectionChip(
- val key: String,
- val label: String,
- val supportingText: String? = null
-)
-
-data class ChipRowItem(
- val key: String,
- val label: String,
- val supportingText: String? = null,
- val onClick: () -> Unit
-)
-
-@Composable
-fun ChipRowSection(
- chips: List<ChipRowItem>,
- selectedKey: String?,
- modifier: Modifier = Modifier,
- title: String? = null,
- subtitle: String? = null,
- headerHorizontalPadding: Int = 24,
- contentPadding: PaddingValues = PaddingValues(horizontal = 24.dp),
- chipHorizontalPadding: Int = 16,
- supportingTextStyle: TextStyle = MaterialTheme.typography.bodySmall,
- supportingTextMaxLines: Int = Int.MAX_VALUE,
- focusedContainerBoostWhenSelected: Boolean = false
-) {
- if (chips.isEmpty()) return
- val sounds = rememberTvInteractionSounds()
-
- Column(
- modifier = modifier
- .fillMaxWidth()
- .padding(vertical = 6.dp)
- .suppressParentVerticalScroll()
- ) {
- if (!title.isNullOrBlank()) {
- Text(
- text = title,
- style = MaterialTheme.typography.labelMedium,
- color = OnSurfaceDim,
- modifier = Modifier.padding(horizontal = headerHorizontalPadding.dp)
- )
- }
- if (!subtitle.isNullOrBlank()) {
- Text(
- text = subtitle,
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim,
- modifier = Modifier.padding(horizontal = headerHorizontalPadding.dp, vertical = 2.dp)
- )
- }
- LazyRow(
- contentPadding = contentPadding,
- horizontalArrangement = Arrangement.spacedBy(10.dp)
- ) {
- items(
- items = chips,
- key = { it.key },
- contentType = { "selection_chip" }
- ) { chip ->
- val isSelected = chip.key == selectedKey
- var wasFocused by remember(chip.key) { mutableStateOf(false) }
- val focusRequester = remember(chip.key) { FocusRequester() }
- Surface(
- onClick = {
- sounds.playSelect()
- chip.onClick()
- },
- modifier = Modifier
- .focusRequester(focusRequester)
- .mouseClickable(
- focusRequester = focusRequester,
- onClick = {
- sounds.playSelect()
- chip.onClick()
- }
- )
- .onFocusChanged {
- if (it.isFocused && !wasFocused) {
- sounds.playNavigate()
- }
- wasFocused = it.isFocused
- },
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (isSelected) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = if (isSelected && focusedContainerBoostWhenSelected) Primary.copy(alpha = 0.28f) else SurfaceHighlight,
- contentColor = if (isSelected) Primary else OnSurface,
- focusedContentColor = OnSurface
- ),
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),
- border = ClickableSurfaceDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(2.dp, FocusBorder),
- shape = RoundedCornerShape(999.dp)
- )
- ),
- scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)
- ) {
- Column(
- modifier = Modifier.padding(horizontal = chipHorizontalPadding.dp, vertical = 10.dp),
- verticalArrangement = Arrangement.spacedBy(2.dp)
- ) {
- Text(
- text = chip.label,
- style = MaterialTheme.typography.labelLarge,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- chip.supportingText?.takeIf { it.isNotBlank() }?.let {
- Text(
- text = it,
- style = supportingTextStyle,
- color = OnSurfaceDim,
- maxLines = supportingTextMaxLines,
- overflow = TextOverflow.Ellipsis
- )
- }
- }
- }
- }
- }
- }
-}
-
-@Composable
-fun SelectionChipRow(
- title: String,
- chips: List<SelectionChip>,
- selectedKey: String?,
- onChipSelected: (String) -> Unit,
- modifier: Modifier = Modifier,
- subtitle: String? = null,
- contentPadding: PaddingValues = PaddingValues(horizontal = 24.dp)
-) {
- ChipRowSection(
- title = title,
- subtitle = subtitle,
- chips = chips.map { chip ->
- ChipRowItem(
- key = chip.key,
- label = chip.label,
- supportingText = chip.supportingText,
- onClick = { onChipSelected(chip.key) }
- )
- },
- selectedKey = selectedKey,
- modifier = modifier,
- contentPadding = contentPadding
- )
-}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.kt b/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.kt
index 4ea5ff59..64a59373 100644
--- a/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.kt
+++ b/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.kt
@@ -53,7 +53,6 @@ import androidx.tv.material3.Text
import coil3.compose.AsyncImage
import com.streamvault.app.R
import com.streamvault.core.ui.image.ChannelLogoBadge
-import com.streamvault.app.ui.components.channelProgressFraction
import com.streamvault.core.ui.image.rememberCrossfadeImageModel
import com.streamvault.core.ui.design.AppColors
import com.streamvault.core.ui.design.AppMotion
@@ -68,6 +67,16 @@ import com.streamvault.domain.model.Episode
import com.streamvault.domain.model.Movie
import com.streamvault.domain.model.Series
+private fun channelProgressFraction(
+ nowMs: Long,
+ startTimeMs: Long,
+ endTimeMs: Long
+): Float {
+ val duration = endTimeMs - startTimeMs
+ if (duration <= 0L) return 0f
+ return ((nowMs - startTimeMs).toFloat() / duration.toFloat()).coerceIn(0f, 1f)
+}
+
@Composable
fun LiveChannelRowCard(
channel: Channel,
diff --git a/app/src/main/java/com/streamvault/app/ui/components/shell/ExternalRatingsStrip.kt b/app/src/main/java/com/streamvault/app/ui/components/shell/ExternalRatingsStrip.kt
deleted file mode 100644
index 0a39c86b..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/shell/ExternalRatingsStrip.kt
+++ /dev/null
@@ -1,147 +0,0 @@
-package com.streamvault.app.ui.components.shell
-
-import androidx.compose.foundation.background
-import androidx.compose.foundation.border
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.FlowRow
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.layout.widthIn
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.text.font.FontWeight
-import androidx.compose.ui.unit.dp
-import androidx.tv.material3.MaterialTheme
-import androidx.tv.material3.Text
-import com.streamvault.app.R
-import com.streamvault.core.ui.design.AppColors
-import com.streamvault.domain.model.ExternalRatingValue
-import com.streamvault.domain.model.ExternalRatings
-
-@Composable
-fun ExternalRatingsStrip(
- ratings: ExternalRatings,
- isLoading: Boolean,
- modifier: Modifier = Modifier
-) {
- if (!isLoading && !ratings.hasAnyAvailableValue()) {
- return
- }
-
- Column(
- modifier = modifier.fillMaxWidth(),
- verticalArrangement = Arrangement.spacedBy(10.dp)
- ) {
- Text(
- text = stringResource(R.string.vod_external_ratings_heading),
- style = MaterialTheme.typography.titleMedium,
- color = AppColors.TextSecondary
- )
-
- FlowRow(
- horizontalArrangement = Arrangement.spacedBy(10.dp),
- verticalArrangement = Arrangement.spacedBy(10.dp)
- ) {
- RatingBadgeCard(
- token = "IMDb",
- title = stringResource(R.string.vod_rating_imdb),
- value = ratings.imdb,
- isLoading = isLoading,
- tokenBackground = Color(0xFFF5C449),
- tokenContent = Color(0xFF111111)
- )
- RatingBadgeCard(
- token = "RT",
- title = stringResource(R.string.vod_rating_rotten_tomatoes),
- value = ratings.rottenTomatoes,
- isLoading = isLoading,
- tokenBackground = Color(0xFFE24E41),
- tokenContent = Color.White
- )
- RatingBadgeCard(
- token = "MC",
- title = stringResource(R.string.vod_rating_metacritic),
- value = ratings.metacritic,
- isLoading = isLoading,
- tokenBackground = Color(0xFFD6E04B),
- tokenContent = Color(0xFF111111)
- )
- RatingBadgeCard(
- token = "TMDb",
- title = stringResource(R.string.vod_rating_tmdb),
- value = ratings.tmdb,
- isLoading = isLoading,
- tokenBackground = Color(0xFF17C7A2),
- tokenContent = Color(0xFF072720)
- )
- }
- }
-}
-
-private fun ExternalRatings.hasAnyAvailableValue(): Boolean {
- return imdb.available || rottenTomatoes.available || metacritic.available || tmdb.available
-}
-
-@Composable
-private fun RatingBadgeCard(
- token: String,
- title: String,
- value: ExternalRatingValue,
- isLoading: Boolean,
- tokenBackground: Color,
- tokenContent: Color
-) {
- val displayValue = if (isLoading) "..." else value.displayValue
- val containerColor = if (value.available || isLoading) {
- AppColors.SurfaceElevated
- } else {
- AppColors.Surface
- }
-
- Column(
- modifier = Modifier
- .widthIn(min = 92.dp)
- .background(containerColor, RoundedCornerShape(18.dp))
- .border(1.dp, AppColors.Outline, RoundedCornerShape(18.dp))
- .padding(horizontal = 12.dp, vertical = 10.dp),
- verticalArrangement = Arrangement.spacedBy(8.dp)
- ) {
- Row(
- verticalAlignment = Alignment.CenterVertically,
- horizontalArrangement = Arrangement.spacedBy(8.dp)
- ) {
- Box(
- modifier = Modifier
- .background(tokenBackground, RoundedCornerShape(8.dp))
- .padding(horizontal = 8.dp, vertical = 3.dp)
- ) {
- Text(
- text = token,
- color = tokenContent,
- style = MaterialTheme.typography.labelMedium,
- fontWeight = FontWeight.Bold
- )
- }
- Text(
- text = title,
- color = AppColors.TextTertiary,
- style = MaterialTheme.typography.labelMedium,
- maxLines = 1
- )
- }
-
- Text(
- text = displayValue,
- color = if (value.available || isLoading) AppColors.TextPrimary else AppColors.TextSecondary,
- style = MaterialTheme.typography.titleMedium,
- fontWeight = FontWeight.SemiBold
- )
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/streamvault/app/ui/components/shell/InfiniteScrollEffect.kt b/app/src/main/java/com/streamvault/app/ui/components/shell/InfiniteScrollEffect.kt
deleted file mode 100644
index 445beeb9..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/shell/InfiniteScrollEffect.kt
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.streamvault.app.ui.components.shell
-
-import androidx.compose.foundation.lazy.LazyListState
-import androidx.compose.foundation.lazy.grid.LazyGridState
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.LaunchedEffect
-import androidx.compose.runtime.derivedStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.snapshotFlow
-import kotlinx.coroutines.flow.distinctUntilChanged
-import kotlinx.coroutines.flow.filter
-
-/**
- * Triggers [onLoadMore] once when the user scrolls within [prefetchDistance]
- * items of the end of the list. The callback is suppressed while [enabled]
- * is false, [canLoadMore] is false, or [isLoading] is true. The effect
- * re-arms after the visible tail moves further from the end and crosses
- * the threshold again.
- */
-@Composable
-fun InfiniteScrollEffect(
- listState: LazyListState,
- enabled: Boolean,
- canLoadMore: Boolean,
- isLoading: Boolean,
- prefetchDistance: Int = 3,
- onLoadMore: () -> Unit
-) {
- if (!enabled) return
- val shouldLoadMore = remember(listState, prefetchDistance) {
- derivedStateOf {
- val info = listState.layoutInfo
- val total = info.totalItemsCount
- if (total == 0) return@derivedStateOf false
- val lastVisible = info.visibleItemsInfo.lastOrNull()?.index ?: return@derivedStateOf false
- lastVisible >= total - 1 - prefetchDistance
- }
- }
- LaunchedEffect(shouldLoadMore, canLoadMore, isLoading) {
- snapshotFlow { shouldLoadMore.value }
- .distinctUntilChanged()
- .filter { it && canLoadMore && !isLoading }
- .collect { onLoadMore() }
- }
-}
-
-/** Grid variant of [InfiniteScrollEffect]. */
-@Composable
-fun InfiniteScrollEffect(
- gridState: LazyGridState,
- enabled: Boolean,
- canLoadMore: Boolean,
- isLoading: Boolean,
- prefetchDistance: Int = 6,
- onLoadMore: () -> Unit
-) {
- if (!enabled) return
- val shouldLoadMore = remember(gridState, prefetchDistance) {
- derivedStateOf {
- val info = gridState.layoutInfo
- val total = info.totalItemsCount
- if (total == 0) return@derivedStateOf false
- val lastVisible = info.visibleItemsInfo.lastOrNull()?.index ?: return@derivedStateOf false
- lastVisible >= total - 1 - prefetchDistance
- }
- }
- LaunchedEffect(shouldLoadMore, canLoadMore, isLoading) {
- snapshotFlow { shouldLoadMore.value }
- .distinctUntilChanged()
- .filter { it && canLoadMore && !isLoading }
- .collect { onLoadMore() }
- }
-}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/shell/VodChrome.kt b/app/src/main/java/com/streamvault/app/ui/components/shell/VodChrome.kt
deleted file mode 100644
index 6e83ecd9..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/shell/VodChrome.kt
+++ /dev/null
@@ -1,434 +0,0 @@
-package com.streamvault.app.ui.components.shell
-
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.BoxWithConstraints
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.FlowRow
-import androidx.compose.foundation.layout.PaddingValues
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.Spacer
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.layout.width
-import androidx.compose.foundation.lazy.LazyColumn
-import androidx.compose.foundation.lazy.items
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.saveable.rememberSaveable
-import androidx.compose.runtime.setValue
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.ExperimentalComposeUiApi
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.focus.FocusRequester
-import androidx.compose.ui.focus.focusRestorer
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.text.style.TextOverflow
-import androidx.compose.ui.unit.dp
-import androidx.compose.ui.res.stringResource
-import com.streamvault.app.device.rememberIsTelevisionDevice
-import androidx.tv.material3.Border
-import androidx.tv.material3.ClickableSurfaceDefaults
-import androidx.tv.material3.MaterialTheme
-import androidx.tv.material3.Surface
-import androidx.tv.material3.SurfaceDefaults
-import androidx.tv.material3.Text
-import com.streamvault.core.ui.design.AppColors
-import com.streamvault.app.ui.components.ChipRowItem
-import com.streamvault.app.ui.components.ChipRowSection
-import com.streamvault.core.ui.design.AppColors.Brand as Primary
-import com.streamvault.core.ui.design.AppColors.Focus as FocusBorder
-import com.streamvault.core.ui.design.AppColors.SurfaceElevated as SurfaceElevated
-import com.streamvault.core.ui.design.AppColors.SurfaceEmphasis as SurfaceHighlight
-import com.streamvault.core.ui.design.AppColors.TextPrimary as TextPrimary
-import com.streamvault.core.ui.design.AppColors.TextTertiary as OnSurfaceDim
-import androidx.compose.foundation.BorderStroke
-import com.streamvault.app.R
-import com.streamvault.core.ui.components.SearchInput
-import com.streamvault.app.ui.components.SelectionChip
-import com.streamvault.app.ui.components.SelectionChipRow
-import com.streamvault.core.ui.components.dialogs.PremiumDialog
-import com.streamvault.core.ui.components.dialogs.PremiumDialogFooterButton
-import com.streamvault.core.ui.interaction.TvClickableSurface
-import com.streamvault.core.ui.interaction.TvButton
-import com.streamvault.core.ui.interaction.TvIconButton
-import com.streamvault.core.ui.components.shell.AppSectionHeader
-
-@Composable
-fun VodSectionHeader(
- title: String,
- onSeeAll: (() -> Unit)? = null,
- seeAllLabel: String = stringResource(R.string.action_see_all)
-) {
- AppSectionHeader(
- title = title,
- modifier = Modifier
- .fillMaxWidth()
- .padding(start = 20.dp, end = 20.dp, top = 14.dp, bottom = 8.dp),
- actionLabel = onSeeAll?.let { seeAllLabel },
- onActionClick = onSeeAll,
- actionContentColor = AppColors.TextSecondary
- )
-}
-
-@OptIn(ExperimentalComposeUiApi::class)
-@Composable
-fun VodActionChipRow(
- actions: List<VodActionChip>,
- selectedKey: String? = null,
- modifier: Modifier = Modifier
-) {
- ChipRowSection(
- chips = actions.map { action ->
- ChipRowItem(
- key = action.key,
- label = action.label,
- supportingText = action.detail,
- onClick = action.onClick
- )
- },
- selectedKey = selectedKey,
- modifier = modifier.focusRestorer(),
- contentPadding = PaddingValues(horizontal = 20.dp),
- chipHorizontalPadding = 14,
- supportingTextStyle = MaterialTheme.typography.labelSmall,
- supportingTextMaxLines = 1,
- focusedContainerBoostWhenSelected = true
- )
-}
-
-@Composable
-fun VodHeroStrip(
- title: String,
- subtitle: String,
- actionLabel: String,
- onClick: () -> Unit,
- modifier: Modifier = Modifier
-) {
- TvClickableSurface(
- onClick = onClick,
- modifier = modifier
- .fillMaxWidth()
- .padding(horizontal = 20.dp)
- .height(132.dp),
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(22.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = SurfaceHighlight,
- focusedContainerColor = Primary.copy(alpha = 0.22f)
- ),
- border = ClickableSurfaceDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(2.dp, FocusBorder),
- shape = RoundedCornerShape(22.dp)
- )
- ),
- scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)
- ) {
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .padding(horizontal = 20.dp, vertical = 18.dp),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically
- ) {
- Column(
- modifier = Modifier.weight(1f),
- verticalArrangement = Arrangement.spacedBy(8.dp)
- ) {
- Text(
- text = title,
- style = MaterialTheme.typography.headlineSmall,
- color = TextPrimary,
- maxLines = 2,
- overflow = TextOverflow.Ellipsis
- )
- Text(
- text = subtitle,
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim,
- maxLines = 2,
- overflow = TextOverflow.Ellipsis
- )
- }
- Surface(
- shape = RoundedCornerShape(999.dp),
- colors = SurfaceDefaults.colors(containerColor = Primary)
- ) {
- Text(
- text = actionLabel,
- style = MaterialTheme.typography.labelLarge,
- color = Color.Black,
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp)
- )
- }
- }
- }
-}
-
-data class VodActionChip(
- val key: String,
- val label: String,
- val detail: String? = null,
- val onClick: () -> Unit
-)
-
-data class VodCategoryOption(
- val name: String,
- val count: Int,
- val onClick: () -> Unit,
- val onLongClick: (() -> Unit)? = null,
- val isLocked: Boolean = false
-)
-
-@Composable
-fun VodCategoryPickerDialog(
- title: String,
- subtitle: String,
- categories: List<VodCategoryOption>,
- onDismiss: () -> Unit
-) {
- var query by rememberSaveable { mutableStateOf("") }
- val searchFocusRequester = remember { FocusRequester() }
- val filteredCategories = remember(categories, query) {
- val normalized = query.trim()
- if (normalized.isBlank()) categories
- else categories.filter { it.name.contains(normalized, ignoreCase = true) }
- }
-
- PremiumDialog(
- title = title,
- subtitle = subtitle,
- onDismissRequest = onDismiss,
- widthFraction = 0.52f,
- content = {
- SearchInput(
- value = query,
- onValueChange = { query = it },
- placeholder = stringResource(R.string.vod_category_picker_search_placeholder),
- focusRequester = searchFocusRequester,
- modifier = Modifier.fillMaxWidth()
- )
-
- if (filteredCategories.isEmpty()) {
- Box(
- modifier = Modifier
- .fillMaxWidth()
- .padding(vertical = 20.dp),
- contentAlignment = Alignment.Center
- ) {
- Text(
- text = stringResource(R.string.vod_category_picker_empty),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- } else {
- BoxWithConstraints(modifier = Modifier.fillMaxWidth()) {
- val isTelevisionDevice = rememberIsTelevisionDevice()
- val listHeight = when {
- maxWidth < 700.dp -> 300.dp
- !isTelevisionDevice && maxWidth < 1280.dp -> 360.dp
- else -> 420.dp
- }
-
- LazyColumn(
- modifier = Modifier.height(listHeight),
- verticalArrangement = Arrangement.spacedBy(8.dp)
- ) {
- items(filteredCategories, key = { it.name }) { category ->
- TvClickableSurface(
- onClick = {
- category.onClick()
- onDismiss()
- },
- onLongClick = category.onLongClick?.let { action ->
- {
- action()
- onDismiss()
- }
- },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = SurfaceElevated,
- focusedContainerColor = SurfaceHighlight
- ),
- border = ClickableSurfaceDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(2.dp, FocusBorder),
- shape = RoundedCornerShape(14.dp)
- )
- ),
- scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)
- ) {
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .padding(horizontal = 16.dp, vertical = 12.dp),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically
- ) {
- Text(
- text = category.name,
- style = MaterialTheme.typography.bodyLarge,
- color = TextPrimary,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis,
- modifier = Modifier.weight(1f)
- )
- if (category.isLocked) {
- Spacer(modifier = Modifier.width(8.dp))
- Text(
- text = stringResource(R.string.home_locked_short),
- style = MaterialTheme.typography.labelSmall,
- color = Primary
- )
- }
- if (category.count > 0) {
- Spacer(modifier = Modifier.width(8.dp))
- Text(
- text = category.count.toString(),
- style = MaterialTheme.typography.labelMedium,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.category_options_cancel),
- onClick = onDismiss
- )
- }
- )
-}
-
-@Composable
-fun VodBrowseOptionsDialog(
- title: String,
- filterTitle: String,
- filterChips: List<SelectionChip>,
- selectedFilterKey: String,
- onFilterSelected: (String) -> Unit,
- sortTitle: String,
- sortChips: List<SelectionChip>,
- selectedSortKey: String,
- onSortSelected: (String) -> Unit,
- onDismiss: () -> Unit
-) {
- PremiumDialog(
- title = title,
- onDismissRequest = onDismiss,
- widthFraction = 0.6f,
- heightFraction = null,
- bodyHeightFraction = 0.44f,
- content = {
- VodBrowseOptionsSection(
- title = filterTitle,
- chips = filterChips,
- selectedKey = selectedFilterKey,
- onChipSelected = onFilterSelected
- )
- VodBrowseOptionsSection(
- title = sortTitle,
- chips = sortChips,
- selectedKey = selectedSortKey,
- onChipSelected = onSortSelected
- )
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.category_options_cancel),
- onClick = onDismiss
- )
- }
- )
-}
-
-@Composable
-private fun VodBrowseOptionsSection(
- title: String,
- chips: List<SelectionChip>,
- selectedKey: String,
- onChipSelected: (String) -> Unit
-) {
- Column(
- modifier = Modifier.fillMaxWidth(),
- verticalArrangement = Arrangement.spacedBy(12.dp)
- ) {
- Text(
- text = title,
- style = MaterialTheme.typography.labelMedium,
- color = AppColors.TextTertiary
- )
- FlowRow(
- modifier = Modifier.fillMaxWidth(),
- horizontalArrangement = Arrangement.spacedBy(10.dp),
- verticalArrangement = Arrangement.spacedBy(10.dp)
- ) {
- chips.forEach { chip ->
- VodBrowseOptionChip(
- label = chip.label,
- supportingText = chip.supportingText,
- selected = chip.key == selectedKey,
- onClick = { onChipSelected(chip.key) }
- )
- }
- }
- }
-}
-
-@Composable
-private fun VodBrowseOptionChip(
- label: String,
- supportingText: String?,
- selected: Boolean,
- onClick: () -> Unit
-) {
- Surface(
- onClick = onClick,
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (selected) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = if (selected) Primary.copy(alpha = 0.28f) else SurfaceHighlight,
- contentColor = if (selected) Primary else TextPrimary,
- focusedContentColor = TextPrimary
- ),
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),
- border = ClickableSurfaceDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(2.dp, FocusBorder),
- shape = RoundedCornerShape(999.dp)
- )
- ),
- scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 18.dp, vertical = 11.dp),
- verticalArrangement = Arrangement.spacedBy(2.dp)
- ) {
- Text(
- text = label,
- style = MaterialTheme.typography.labelLarge,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- supportingText?.takeIf { it.isNotBlank() }?.let { detail ->
- Text(
- text = detail,
- style = MaterialTheme.typography.bodySmall,
- color = AppColors.TextTertiary,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- }
- }
- }
-}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/shell/VodClassicBrowser.kt b/app/src/main/java/com/streamvault/app/ui/components/shell/VodClassicBrowser.kt
deleted file mode 100644
index 894beec0..00000000
--- a/app/src/main/java/com/streamvault/app/ui/components/shell/VodClassicBrowser.kt
+++ /dev/null
@@ -1,243 +0,0 @@
-package com.streamvault.app.ui.components.shell
-
-import androidx.compose.foundation.BorderStroke
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.Spacer
-import androidx.compose.foundation.layout.fillMaxHeight
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.layout.width
-import androidx.compose.foundation.lazy.LazyColumn
-import androidx.compose.foundation.lazy.items
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.setValue
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.focus.onFocusChanged
-import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.text.style.TextOverflow
-import androidx.compose.ui.unit.dp
-import androidx.tv.material3.Border
-import androidx.tv.material3.ClickableSurfaceDefaults
-import androidx.tv.material3.MaterialTheme
-import androidx.tv.material3.Surface
-import androidx.tv.material3.Text
-import com.streamvault.app.R
-import com.streamvault.app.ui.components.FocusedMarqueeText
-import com.streamvault.core.ui.design.AppColors
-import com.streamvault.core.ui.design.FocusSpec
-import com.streamvault.core.ui.interaction.TvClickableSurface
-import com.streamvault.core.ui.interaction.TvButton
-import com.streamvault.core.ui.interaction.TvIconButton
-
-data class VodClassicCategoryOption(
- val key: String,
- val label: String,
- val count: Int,
- val isSelected: Boolean,
- val onClick: () -> Unit,
- val onLongClick: (() -> Unit)? = null,
- val isLocked: Boolean = false
-)
-
-@Composable
-fun VodClassicSplitLayout(
- railTitle: String,
- railSearchValue: String,
- onRailSearchValueChange: (String) -> Unit,
- railSearchPlaceholder: String,
- categories: List<VodClassicCategoryOption>,
- modifier: Modifier = Modifier,
- content: @Composable () -> Unit
-) {
- Row(
- modifier = modifier.fillMaxSize(),
- horizontalArrangement = Arrangement.spacedBy(20.dp)
- ) {
- CategoryRailPanel(
- title = railTitle,
- searchValue = railSearchValue,
- onSearchValueChange = onRailSearchValueChange,
- searchPlaceholder = railSearchPlaceholder,
- modifier = Modifier
- .width(320.dp)
- .fillMaxHeight(),
- contentPadding = PaddingValues(bottom = 24.dp)
- ) {
- items(categories, key = { it.key }) { category ->
- var isFocused by remember(category.key) { mutableStateOf(false) }
- TvClickableSurface(
- onClick = category.onClick,
- onLongClick = category.onLongClick,
- modifier = Modifier
- .fillMaxWidth()
- .onFocusChanged { isFocused = it.isFocused },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (category.isSelected) AppColors.Brand.copy(alpha = 0.22f) else AppColors.SurfaceElevated,
- focusedContainerColor = AppColors.SurfaceEmphasis,
- contentColor = if (category.isSelected) AppColors.BrandStrong else AppColors.TextPrimary,
- focusedContentColor = AppColors.TextPrimary
- ),
- border = ClickableSurfaceDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(FocusSpec.BorderWidth, AppColors.Focus),
- shape = RoundedCornerShape(14.dp)
- )
- ),
- scale = ClickableSurfaceDefaults.scale(focusedScale = FocusSpec.FocusedScale)
- ) {
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .padding(horizontal = 14.dp, vertical = 12.dp),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically
- ) {
- FocusedMarqueeText(
- text = category.label,
- isFocused = isFocused,
- style = MaterialTheme.typography.titleSmall,
- color = if (category.isSelected) AppColors.BrandStrong else AppColors.TextPrimary,
- maxLines = 1,
- modifier = Modifier.weight(1f)
- )
- if (category.isLocked) {
- Spacer(modifier = Modifier.width(8.dp))
- Text(
- text = stringResource(R.string.home_locked_short),
- style = MaterialTheme.typography.labelSmall,
- color = AppColors.BrandStrong
- )
- }
- if (category.count > 0) {
- Spacer(modifier = Modifier.width(12.dp))
- Text(
- text = category.count.toString(),
- style = MaterialTheme.typography.bodySmall,
- color = AppColors.TextSecondary
- )
- }
- }
- }
- }
- }
-
- Box(
- modifier = Modifier
- .weight(1f)
- .fillMaxHeight()
- .background(AppColors.Canvas, RoundedCornerShape(28.dp))
- .padding(horizontal = 16.dp, vertical = 14.dp)
- ) {
- content()
- }
- }
-}
-
-@Composable
-fun VodClassicContentHeader(
- title: String,
- subtitle: String,
- actions: List<VodActionChip>,
- selectedActionKey: String? = null,
- modifier: Modifier = Modifier
-) {
- Row(
- modifier = modifier.fillMaxWidth(),
- horizontalArrangement = Arrangement.spacedBy(16.dp),
- verticalAlignment = Alignment.CenterVertically
- ) {
- Column(
- modifier = Modifier.weight(1f),
- verticalArrangement = Arrangement.spacedBy(2.dp)
- ) {
- Text(
- text = title,
- style = MaterialTheme.typography.headlineSmall,
- color = AppColors.TextPrimary,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- if (subtitle.isNotBlank()) {
- Text(
- text = subtitle,
- style = MaterialTheme.typography.bodySmall,
- color = AppColors.TextSecondary,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- }
- }
-
- Row(
- horizontalArrangement = Arrangement.spacedBy(10.dp),
- verticalAlignment = Alignment.CenterVertically
- ) {
- actions.forEach { action ->
- VodClassicHeaderActionButton(
- action = action,
- isSelected = action.key == selectedActionKey
- )
- }
- }
- }
-}
-
-@Composable
-private fun VodClassicHeaderActionButton(
- action: VodActionChip,
- isSelected: Boolean = false,
- modifier: Modifier = Modifier
-) {
- TvClickableSurface(
- onClick = action.onClick,
- modifier = modifier,
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(18.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (isSelected) AppColors.Brand.copy(alpha = 0.18f) else AppColors.SurfaceElevated,
- focusedContainerColor = AppColors.SurfaceEmphasis,
- contentColor = if (isSelected) AppColors.BrandStrong else AppColors.TextPrimary,
- focusedContentColor = AppColors.TextPrimary
- ),
- border = ClickableSurfaceDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(FocusSpec.BorderWidth, AppColors.Focus),
- shape = RoundedCornerShape(18.dp)
- )
- ),
- scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 18.dp, vertical = 10.dp),
- verticalArrangement = Arrangement.spacedBy(2.dp)
- ) {
- Text(
- text = action.label,
- style = MaterialTheme.typography.titleSmall,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- action.detail?.takeIf { it.isNotBlank() }?.let { detail ->
- Text(
- text = detail,
- style = MaterialTheme.typography.labelSmall,
- color = if (isSelected) AppColors.Brand else AppColors.TextSecondary,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- }
- }
- }
-}
diff --git a/app/src/test/java/com/streamvault/app/ui/components/ChannelProgressTickerTest.kt b/app/src/test/java/com/streamvault/app/ui/components/ChannelProgressTickerTest.kt
deleted file mode 100644
index 2e06fdb8..00000000
--- a/app/src/test/java/com/streamvault/app/ui/components/ChannelProgressTickerTest.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.streamvault.app.ui.components
-
-import com.google.common.truth.Truth.assertThat
-import org.junit.Test
-
-class ChannelProgressTickerTest {
-
- @Test
- fun `progress is clamped to the program interval`() {
- assertThat(channelProgressFraction(90L, 100L, 200L)).isEqualTo(0f)
- assertThat(channelProgressFraction(150L, 100L, 200L)).isEqualTo(0.5f)
- assertThat(channelProgressFraction(250L, 100L, 200L)).isEqualTo(1f)
- }
-
- @Test
- fun `progress is zero for a non-positive duration`() {
- assertThat(channelProgressFraction(150L, 100L, 100L)).isEqualTo(0f)
- assertThat(channelProgressFraction(150L, 200L, 100L)).isEqualTo(0f)
- }
-}
diff --git a/app/src/androidTest/assets/ui-goldens/route_dashboard_default.png b/feature/catalog/src/androidTest/assets/ui-goldens/route_dashboard_default.png
similarity index 100%
rename from app/src/androidTest/assets/ui-goldens/route_dashboard_default.png
rename to feature/catalog/src/androidTest/assets/ui-goldens/route_dashboard_default.png
diff --git a/app/src/androidTest/assets/ui-goldens/route_movies_landing.png b/feature/catalog/src/androidTest/assets/ui-goldens/route_movies_landing.png
similarity index 100%
rename from app/src/androidTest/assets/ui-goldens/route_movies_landing.png
rename to feature/catalog/src/androidTest/assets/ui-goldens/route_movies_landing.png
diff --git a/app/src/androidTest/assets/ui-goldens/route_search_results.png b/feature/catalog/src/androidTest/assets/ui-goldens/route_search_results.png
similarity index 100%
rename from app/src/androidTest/assets/ui-goldens/route_search_results.png
rename to feature/catalog/src/androidTest/assets/ui-goldens/route_search_results.png
diff --git a/app/src/androidTest/assets/ui-goldens/route_series_detail.png b/feature/catalog/src/androidTest/assets/ui-goldens/route_series_detail.png
similarity index 100%
rename from app/src/androidTest/assets/ui-goldens/route_series_detail.png
rename to feature/catalog/src/androidTest/assets/ui-goldens/route_series_detail.png
diff --git a/feature/catalog/src/androidTest/java/com/streamvault/feature/catalog/CatalogPresentationGoldenTest.kt b/feature/catalog/src/androidTest/java/com/streamvault/feature/catalog/CatalogPresentationGoldenTest.kt
new file mode 100644
index 00000000..ecb6ae6a
--- /dev/null
+++ b/feature/catalog/src/androidTest/java/com/streamvault/feature/catalog/CatalogPresentationGoldenTest.kt
@@ -0,0 +1,108 @@
+package com.streamvault.feature.catalog
+
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.layout.height
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.unit.dp
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.tv.material3.MaterialTheme
+import com.streamvault.core.ui.components.SearchInput
+import com.streamvault.core.ui.components.shell.AppHeroHeader
+import com.streamvault.core.ui.components.shell.AppSectionHeader
+import com.streamvault.core.ui.components.shell.ContentMetadataStrip
+import com.streamvault.core.ui.components.shell.StatusPill
+import com.streamvault.core.ui.theme.StreamVaultTheme
+import com.streamvault.domain.model.Channel
+import com.streamvault.domain.model.Movie
+import com.streamvault.domain.model.Series
+import com.streamvault.feature.catalog.presentation.components.ChannelCard
+import com.streamvault.feature.catalog.presentation.components.MovieCard
+import com.streamvault.feature.catalog.presentation.components.SeriesCard
+import com.streamvault.feature.catalog.test.assertAgainstGolden
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+class CatalogPresentationGoldenTest {
+
+ @get:Rule
+ val composeRule = createComposeRule()
+
+ @Test
+ fun dashboard_route_matchesGolden() = captureGolden("route_dashboard_default") {
+ Column(verticalArrangement = Arrangement.spacedBy(18.dp)) {
+ AppHeroHeader(
+ title = "Your Library, Ready",
+ subtitle = "One place for live shortcuts, recent progress, and provider health.",
+ eyebrow = "Dashboard",
+ footer = { ContentMetadataStrip(values = listOf("126 live", "18 to resume", "2 alerts")) }
+ )
+ AppSectionHeader(title = "Continue Watching", subtitle = "Recent items kept within reach.")
+ Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
+ MovieCard(movie = movie(), onClick = {})
+ SeriesCard(series = series(), onClick = {})
+ ChannelCard(channel = channel(), nowMs = 0L, onClick = {})
+ }
+ }
+ }
+
+ @Test
+ fun movies_route_matchesGolden() = captureGolden("route_movies_landing") {
+ Column(verticalArrangement = Arrangement.spacedBy(18.dp)) {
+ AppHeroHeader(title = "Movies", subtitle = "Curated shelves and category jumps.")
+ Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
+ MovieCard(movie = movie(), onClick = {})
+ MovieCard(movie = movie().copy(id = 2L, name = "Coastline"), onClick = {})
+ }
+ }
+ }
+
+ @Test
+ fun series_detail_route_matchesGolden() = captureGolden("route_series_detail") {
+ Column(verticalArrangement = Arrangement.spacedBy(18.dp)) {
+ AppHeroHeader(title = "Series Detail", subtitle = "Season browsing and progress-aware episodes.")
+ AppSectionHeader(title = "Season 1", subtitle = "8 episodes available")
+ SeriesCard(series = series(), onClick = {})
+ }
+ }
+
+ @Test
+ fun search_route_matchesGolden() = captureGolden("route_search_results") {
+ Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
+ AppHeroHeader(title = "Search", subtitle = "Unified results across live, movies, and series.")
+ SearchInput(value = "night", onValueChange = {}, placeholder = "Search everything")
+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ StatusPill(label = "Live 12")
+ StatusPill(label = "Movies 8")
+ StatusPill(label = "Series 4")
+ }
+ }
+ }
+
+ private fun captureGolden(name: String, content: @androidx.compose.runtime.Composable () -> Unit) {
+ composeRule.setContent {
+ StreamVaultTheme {
+ MaterialTheme {
+ Box(Modifier.fillMaxSize().padding(24.dp).testTag("golden")) {
+ content()
+ }
+ }
+ }
+ }
+ composeRule.onNodeWithTag("golden").assertAgainstGolden(name)
+ }
+
+ private fun movie() = Movie(id = 1L, name = "The Night Shift", year = "2026", rating = 8.8f)
+ private fun series() = Series(id = 1L, name = "The Long Road", releaseDate = "2026", rating = 8.5f)
+ private fun channel() = Channel(id = 1L, name = "Headline News", streamUrl = "https://example.test/live.m3u8")
+}
diff --git a/feature/catalog/src/androidTest/java/com/streamvault/feature/catalog/test/GoldenCapture.kt b/feature/catalog/src/androidTest/java/com/streamvault/feature/catalog/test/GoldenCapture.kt
new file mode 100644
index 00000000..55a4181d
--- /dev/null
+++ b/feature/catalog/src/androidTest/java/com/streamvault/feature/catalog/test/GoldenCapture.kt
@@ -0,0 +1,69 @@
+package com.streamvault.feature.catalog.test
+
+import android.graphics.Bitmap
+import androidx.compose.ui.graphics.asAndroidBitmap
+import androidx.compose.ui.test.SemanticsNodeInteraction
+import androidx.compose.ui.test.captureToImage
+import androidx.test.platform.app.InstrumentationRegistry
+import java.io.File
+import java.io.FileNotFoundException
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertTrue
+
+private const val RECORD_GOLDENS_ARGUMENT = "recordGoldens"
+
+fun SemanticsNodeInteraction.assertAgainstGolden(goldenName: String) {
+ val bitmap = captureToImage().asAndroidBitmap()
+ val instrumentation = InstrumentationRegistry.getInstrumentation()
+ val targetContext = instrumentation.targetContext
+ val shouldRecord = InstrumentationRegistry.getArguments()
+ .getString(RECORD_GOLDENS_ARGUMENT) == "true"
+
+ if (shouldRecord) {
+ val outputDirs = listOfNotNull(
+ File(targetContext.filesDir, "ui-goldens"),
+ targetContext.externalCacheDir?.let { File(it, "ui-goldens") },
+ )
+ outputDirs.forEach { outputDir ->
+ outputDir.mkdirs()
+ File(outputDir, "$goldenName.png").outputStream().use { stream ->
+ bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream)
+ }
+ }
+ assertTrue(outputDirs.all { File(it, "$goldenName.png").exists() })
+ instrumentation.uiAutomation
+ .executeShellCommand(
+ "cp ${outputDirs.last().absolutePath}/$goldenName.png " +
+ "/sdcard/Download/streamvault-app-golden-$goldenName.png"
+ )
+ .close()
+ return
+ }
+
+ val expected = try {
+ instrumentation.context.assets
+ .open("ui-goldens/$goldenName.png")
+ .use { stream ->
+ android.graphics.BitmapFactory.decodeStream(stream)
+ ?: throw AssertionError("Golden asset ui-goldens/$goldenName.png is not a readable bitmap")
+ }
+ } catch (_: FileNotFoundException) {
+ throw AssertionError(
+ "Missing golden asset ui-goldens/$goldenName.png; " +
+ "run the connected test with -Pandroid.testInstrumentationRunnerArguments.recordGoldens=true " +
+ "and copy the generated file into feature/catalog/src/androidTest/assets/ui-goldens/"
+ )
+ }
+ assertBitmapsEqual(expected, bitmap, goldenName)
+}
+
+private fun assertBitmapsEqual(expected: Bitmap, actual: Bitmap, goldenName: String) {
+ assertEquals(expected.width, actual.width)
+ assertEquals(expected.height, actual.height)
+
+ for (y in 0 until expected.height) {
+ for (x in 0 until expected.width) {
+ assertEquals("$goldenName@$x,$y", expected.getPixel(x, y), actual.getPixel(x, y))
+ }
+ }
+}
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/CatalogRowScrollFix.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/CatalogRowScrollFix.kt
index 3c2ac4b3..38d59c6f 100644
--- a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/CatalogRowScrollFix.kt
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/CatalogRowScrollFix.kt
@@ -7,6 +7,7 @@ import androidx.compose.foundation.relocation.BringIntoViewResponder
import androidx.compose.foundation.relocation.bringIntoViewResponder
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
@@ -22,7 +23,7 @@ import androidx.compose.ui.layout.onSizeChanged
*/
@OptIn(ExperimentalFoundationApi::class)
fun Modifier.suppressParentVerticalScroll(): Modifier = composed {
- var height by mutableFloatStateOf(0f)
+ var height by remember { mutableFloatStateOf(0f) }
this
.onSizeChanged { height = it.height.toFloat() }
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/dashboard/DashboardScreen.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/dashboard/DashboardScreen.kt
index 7547561d..a0b620ee 100644
--- a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/dashboard/DashboardScreen.kt
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/dashboard/DashboardScreen.kt
@@ -602,22 +602,20 @@ private fun DashboardProviderHealthCard(
health: DashboardProviderHealth,
onOpenDiagnostics: () -> Unit
) {
- val context = androidx.compose.ui.platform.LocalContext.current
val appTimeFormat = LocalCatalogTimeFormat.current
val dateTimeFormat = remember(appTimeFormat) { appTimeFormat.createCatalogDateTimeFormat() }
- val syncLabel = remember(health.lastSyncedAt, dateTimeFormat) {
- if (health.lastSyncedAt <= 0L) {
- context.getString(R.string.dashboard_provider_no_sync)
- } else {
- context.getString(R.string.dashboard_provider_synced_at, dateTimeFormat.format(Date(health.lastSyncedAt)))
- }
- }
- val expiryLabel = remember(health.expirationDate) {
- health.expirationDate?.let {
- val format = SimpleDateFormat("MMM d, yyyy", Locale.getDefault())
- context.getString(R.string.dashboard_provider_expires_at, format.format(Date(it)))
- } ?: context.getString(R.string.dashboard_provider_no_expiry)
+ val syncLabel = if (health.lastSyncedAt <= 0L) {
+ stringResource(R.string.dashboard_provider_no_sync)
+ } else {
+ stringResource(
+ R.string.dashboard_provider_synced_at,
+ dateTimeFormat.format(Date(health.lastSyncedAt))
+ )
}
+ val expiryLabel = health.expirationDate?.let {
+ val format = remember(it) { SimpleDateFormat("MMM d, yyyy", Locale.getDefault()) }
+ stringResource(R.string.dashboard_provider_expires_at, format.format(Date(it)))
+ } ?: stringResource(R.string.dashboard_provider_no_expiry)
val statusLabel = when (health.status) {
com.streamvault.domain.model.ProviderStatus.ACTIVE -> stringResource(R.string.settings_status_active)
com.streamvault.domain.model.ProviderStatus.PARTIAL -> stringResource(R.string.settings_status_partial)
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/favorites/FavoritesViewModel.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/favorites/FavoritesViewModel.kt
index 60749306..3685ccbd 100644
--- a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/favorites/FavoritesViewModel.kt
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/favorites/FavoritesViewModel.kt
@@ -1,5 +1,7 @@
package com.streamvault.feature.catalog.presentation.favorites
+import android.annotation.SuppressLint
+
import android.content.Context
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
@@ -642,6 +644,7 @@ class FavoritesViewModel @Inject constructor(
}
}
+ @SuppressLint("StringFormatMatches")
private fun observeSavedHistory(providerIds: Set<Long>): Flow<SavedHistorySnapshot> {
if (providerIds.isEmpty()) {
return flowOf(SavedHistorySnapshot())
@@ -699,7 +702,13 @@ class FavoritesViewModel @Inject constructor(
val s = entry.seasonNumber
val e = entry.episodeNumber
if (s != null && e != null) {
- append(appContext.getString(R.string.favorites_content_type_episode_format, s, e))
+ append(
+ appContext.getString(
+ R.string.favorites_content_type_episode_format,
+ s ?: 0,
+ e ?: 0
+ )
+ )
} else {
append(appContext.getString(R.string.favorites_content_type_episode))
entry.seasonNumber?.let { append(" S$it") }
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/movies/MoviesScreen.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/movies/MoviesScreen.kt
index 751b5d54..c74db8e0 100644
--- a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/movies/MoviesScreen.kt
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/movies/MoviesScreen.kt
@@ -99,7 +99,7 @@ fun MoviesScreen(
scaffold: CatalogScaffoldContent,
viewModel: MoviesViewModel = hiltViewModel()
) {
- remember(viewModel) {
+ LaunchedEffect(viewModel) {
viewModel.resetPreviewRowsForScreenEntry()
}
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
@@ -109,7 +109,6 @@ fun MoviesScreen(
var pinError by remember { mutableStateOf<String?>(null) }
var pendingMovie by remember { mutableStateOf<Movie?>(null) }
var pendingCategory by remember { mutableStateOf<Category?>(null) }
- val context = androidx.compose.ui.platform.LocalContext.current
HandleVodUserMessage(
userMessage = uiState.userMessage,
@@ -124,7 +123,7 @@ fun MoviesScreen(
ProtectedVodPinDialog(
visible = showPinDialog,
error = pinError,
- incorrectPinMessage = context.getString(R.string.movies_incorrect_pin),
+ incorrectPinMessage = stringResource(R.string.movies_incorrect_pin),
onDismissRequest = {
showPinDialog = false
pinError = null
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/search/SearchScreen.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/search/SearchScreen.kt
index 5ca15120..1c4fdf7c 100644
--- a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/search/SearchScreen.kt
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/search/SearchScreen.kt
@@ -381,7 +381,6 @@ fun SearchScreen(
val nowMs by CatalogChannelProgressTicker.nowMs.collectAsStateWithLifecycle()
val focusManager = LocalFocusManager.current
val searchFocusRequester = remember { FocusRequester() }
- val context = androidx.compose.ui.platform.LocalContext.current
var showPinDialog by remember { mutableStateOf(false) }
var pinError by remember { mutableStateOf<String?>(null) }
var pendingChannel by remember { mutableStateOf<Channel?>(null) }
@@ -389,6 +388,7 @@ fun SearchScreen(
var pendingSeries by remember { mutableStateOf<Series?>(null) }
val scope = rememberCoroutineScope()
val selectedStateLabel = stringResource(R.string.a11y_selected)
+ val incorrectPinMessage = stringResource(R.string.search_incorrect_pin)
// ג”€ג”€ Long-press actions dialog state ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€
var showActionsDialog by remember { mutableStateOf(false) }
@@ -490,7 +490,7 @@ fun SearchScreen(
pendingSeries = null
}
} else {
- pinError = context.getString(R.string.search_incorrect_pin)
+ pinError = incorrectPinMessage
}
}
},
@@ -633,7 +633,7 @@ fun SearchScreen(
item {
SearchResultRail(
title = stringResource(R.string.search_live_tv),
- items = uiState.channels.take(18),
+ items = uiState.channels.subList(0, minOf(uiState.channels.size, 18)),
keySelector = { it.id }
) { channel ->
val channelLocked = isLocked(
@@ -665,7 +665,7 @@ fun SearchScreen(
item {
SearchResultRail(
title = stringResource(R.string.search_movies),
- items = uiState.movies.take(18),
+ items = uiState.movies.subList(0, minOf(uiState.movies.size, 18)),
keySelector = { it.id }
) { movie ->
val movieLocked = isLocked(
@@ -694,7 +694,7 @@ fun SearchScreen(
item {
SearchResultRail(
title = stringResource(R.string.search_series),
- items = uiState.series.take(18),
+ items = uiState.series.subList(0, minOf(uiState.series.size, 18)),
keySelector = { it.id }
) { seriesItem ->
val seriesLocked = isLocked(
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/series/SeriesScreen.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/series/SeriesScreen.kt
index b4b458ec..c1d84d53 100644
--- a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/series/SeriesScreen.kt
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/series/SeriesScreen.kt
@@ -99,7 +99,7 @@ fun SeriesScreen(
scaffold: CatalogScaffoldContent,
viewModel: SeriesViewModel = hiltViewModel()
) {
- remember(viewModel) {
+ LaunchedEffect(viewModel) {
viewModel.resetPreviewRowsForScreenEntry()
}
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
@@ -109,7 +109,6 @@ fun SeriesScreen(
var pinError by remember { mutableStateOf<String?>(null) }
var pendingSeries by remember { mutableStateOf<Series?>(null) }
var pendingCategory by remember { mutableStateOf<Category?>(null) }
- val context = androidx.compose.ui.platform.LocalContext.current
HandleVodUserMessage(
userMessage = uiState.userMessage,
@@ -124,7 +123,7 @@ fun SeriesScreen(
ProtectedVodPinDialog(
visible = showPinDialog,
error = pinError,
- incorrectPinMessage = context.getString(R.string.series_incorrect_pin),
+ incorrectPinMessage = stringResource(R.string.series_incorrect_pin),
onDismissRequest = {
showPinDialog = false
pinError = null
diff --git a/validation/phase5_catalog/task11-resource-cleanup.md b/validation/phase5_catalog/task11-resource-cleanup.md
new file mode 100644
index 00000000..187363c4
--- /dev/null
+++ b/validation/phase5_catalog/task11-resource-cleanup.md
@@ -0,0 +1,48 @@
+# Phase 5 Catalog — Task 11 resource and golden ownership
+
+Date: 2026-09-02
+Scope: `:feature:catalog` ownership migration and structural cleanup
+
+## Golden fixtures
+
+The four Catalog route baselines now live in
+`feature/catalog/src/androidTest/assets/ui-goldens/`:
+
+| Fixture | Previous path | New path | Content check |
+| --- | --- | --- | --- |
+| `route_dashboard_default.png` | `app/src/androidTest/assets/ui-goldens/` | `feature/catalog/src/androidTest/assets/ui-goldens/` | Git blob unchanged (`89a9ab988988ddd75a1806c9f35f094ed5701df5`) |
+| `route_movies_landing.png` | app | feature | Git blob unchanged (`0765a4041b16abf63e66f1975a120234b27ff0d2`) |
+| `route_series_detail.png` | app | feature | Git blob unchanged (`0e15b61d39b6d6cfb2e5794dcc234886278ce1c0`) |
+| `route_search_results.png` | app | feature | Git blob unchanged (`b10b54fd369396b897171e8d2787f6fadb5bccee`) |
+
+`CatalogPresentationGoldenTest` owns the same four test names and baseline
+names. `PremiumRouteGoldenTest` retains only the live and saved/guide/settings
+app-shell fixtures.
+
+## Resource audit
+
+No app locale resource was deleted in this task. The feature resource set is
+intentionally duplicated while app-shell and compatibility surfaces continue to
+resolve shared strings. The audit was run with:
+
+```powershell
+powershell -ExecutionPolicy Bypass -File validation/phase5_catalog/locale_audit.ps1
+```
+
+Result: exit code `0`; 351 expected keys; missing `0`; value mismatches `0`;
+format mismatches `0`; unexpected keys `0`; 525 source-locale fallbacks are
+allowed and reported for transparency. Android resource processing also passed:
+
+```text
+:feature:catalog:processDebugResources PASS
+:app:processDebugResources PASS
+```
+
+## Test helper ownership
+
+`GoldenCapture.kt` moved to
+`feature/catalog/src/androidTest/java/com/streamvault/feature/catalog/test/`
+and now reports the feature asset path. The obsolete app
+`ChannelProgressTickerTest` was removed because its behavior is covered by the
+feature-owned primitive test; the app shell card keeps a private equivalent
+progress calculation for its retained shell golden fixture.
diff --git a/validation/phase5_catalog/task11-structural-verification.md b/validation/phase5_catalog/task11-structural-verification.md
new file mode 100644
index 00000000..d33087e1
--- /dev/null
+++ b/validation/phase5_catalog/task11-structural-verification.md
@@ -0,0 +1,62 @@
+# Phase 5 Catalog — Task 11 structural verification
+
+Date: 2026-09-02
+
+## Ownership checks
+
+The following scans returned no matches:
+
+```text
+rg package com.streamvault.app.ui.screens.(dashboard|movies|series|vod|favorites|search) app/src/main app/src/test
+rg forbidden app/catalog source imports (app, player, sibling feature, MainActivity, NavController) feature/catalog/src/main
+```
+
+The feature boundary verifier also reports zero forbidden main-source
+references and the four approved project dependencies.
+
+## Catalog-only app declarations removed
+
+Repository-wide consumer scans found no remaining production, unit-test, or
+instrumentation consumer for these app declarations after the feature copies
+were wired:
+
+| Removed app file | Feature owner |
+| --- | --- |
+| `ui/components/Cards.kt` | `presentation/components/CatalogCards.kt` |
+| `ui/components/CategoryRow.kt` | `CatalogCategoryRow.kt` |
+| `ui/components/ContinueWatchingRow.kt` | `CatalogContinueWatchingRow.kt` |
+| `ui/components/ChannelProgressTicker.kt` | `CatalogChannelProgressTicker.kt` |
+| `ui/components/FocusedMarqueeText.kt` | `CatalogFocusedMarqueeText.kt` |
+| `ui/components/ReorderTopBar.kt` | `CatalogReorderTopBar.kt` |
+| `ui/components/SavedCategoryContextCard.kt` | `CatalogSavedCategoryContextCard.kt` |
+| `ui/components/SavedCategoryShortcutsRow.kt` | `CatalogSavedCategoryShortcutsRow.kt` |
+| `ui/components/RowScrollFix.kt` | `CatalogRowScrollFix.kt` |
+| `ui/components/SelectionChipRow.kt` | `CatalogSelectionChipRow.kt` |
+| `ui/components/shell/ExternalRatingsStrip.kt` | `CatalogExternalRatingsStrip.kt` |
+| `ui/components/shell/InfiniteScrollEffect.kt` | `CatalogInfiniteScrollEffect.kt` |
+| `ui/components/shell/VodChrome.kt` | `CatalogVodChrome.kt` |
+| `ui/components/shell/VodClassicBrowser.kt` | `CatalogVodClassicBrowser.kt` |
+
+The app `ChannelProgressTickerTest` was deleted with its source.
+`AppShellNavigation.kt`, `LibraryBrowseScaffold.kt`, and `AppMediaCards.kt`
+remain because app-shell and remaining app golden tests still consume them.
+`CustomKeyboard.kt`, `PlaylistSwitcher.kt`, and `SkeletonLoader.kt` were outside
+the Catalog migration and were not changed.
+
+## Build and test evidence
+
+```text
+:feature:catalog:compileDebugAndroidTestKotlin :app:compileDebugAndroidTestKotlin PASS
+:feature:catalog:processDebugResources :app:processDebugResources PASS
+:feature:catalog:verifyFeatureCatalogBoundary PASS
+:feature:catalog:testDebugUnitTest :app:testDebugUnitTest PASS
+:feature:catalog:lintDebug PASS (802 warnings, 1 hint)
+:feature:catalog:assembleDebug :app:assembleDebug PASS
+:app:compileDebugKotlin :app:compileDebugUnitTestKotlin PASS
+```
+
+The focused Android-test compilation completed after the app component cleanup,
+and the full structural/unit/lint/assemble matrix passed. Gradle reported 24
+configuration-cache diagnostics for the existing boundary task implementation;
+they do not affect task correctness. Connected golden execution is deferred to
+Task 12 and requires the configured Android TV target.