Skip to content

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

refactor(live): extract guide control rows

David Nashash77552ba7bb1c
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgControlComponents.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgControlComponents.kt
deleted file mode 100644
index 9f98b567..00000000
--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgControlComponents.kt
+++ /dev/null
@@ -1,339 +0,0 @@
-package com.streamvault.app.ui.screens.epg
-
-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.Spacer
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.layout.widthIn
-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.LaunchedEffect
-import androidx.compose.runtime.remember
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.focus.FocusRequester
-import androidx.compose.ui.focus.focusRequester
-import androidx.compose.ui.res.stringResource
-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.Text
-import com.streamvault.app.R
-import com.streamvault.feature.live.presentation.epg.GuideChannelMode
-import com.streamvault.feature.live.presentation.epg.GuideDensity
-import com.streamvault.app.ui.components.SelectionChip
-import com.streamvault.app.ui.components.SelectionChipRow
-import com.streamvault.feature.live.presentation.epg.dayRelativeOffset
-import com.streamvault.feature.live.presentation.epg.shiftGuideDayStart
-import com.streamvault.feature.live.presentation.epg.startOfGuideDay
-import com.streamvault.feature.live.presentation.epg.LiveGuideShortcutChip
-import com.streamvault.core.ui.interaction.TvClickableSurface
-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 java.text.SimpleDateFormat
-import java.util.Date
-import java.util.Locale
-import java.time.LocalDate
-import java.time.ZoneId
-
-@Composable
-internal fun GuideDensityRow(
- selectedDensity: GuideDensity,
- onDensitySelected: (GuideDensity) -> Unit
-) {
- SelectionChipRow(
- title = stringResource(R.string.epg_density_label),
- subtitle = stringResource(R.string.epg_density_subtitle),
- chips = listOf(
- SelectionChip(
- key = GuideDensity.COMPACT.name,
- label = stringResource(R.string.epg_density_compact),
- supportingText = stringResource(R.string.epg_density_compact_hint)
- ),
- SelectionChip(
- key = GuideDensity.COMFORTABLE.name,
- label = stringResource(R.string.epg_density_comfortable),
- supportingText = stringResource(R.string.epg_density_comfortable_hint)
- ),
- SelectionChip(
- key = GuideDensity.CINEMATIC.name,
- label = stringResource(R.string.epg_density_cinematic),
- supportingText = stringResource(R.string.epg_density_cinematic_hint)
- )
- ),
- selectedKey = selectedDensity.name,
- onChipSelected = { key ->
- GuideDensity.entries.firstOrNull { it.name == key }?.let(onDensitySelected)
- }
- )
-}
-
-
-@Composable
-internal fun GuideModeRow(
- selectedMode: GuideChannelMode,
- onModeSelected: (GuideChannelMode) -> Unit
-) {
- SelectionChipRow(
- title = stringResource(R.string.epg_mode_label),
- subtitle = stringResource(R.string.epg_mode_subtitle),
- chips = listOf(
- SelectionChip(
- key = GuideChannelMode.ALL.name,
- label = stringResource(R.string.epg_mode_all),
- supportingText = stringResource(R.string.epg_mode_all_hint)
- ),
- SelectionChip(
- key = GuideChannelMode.ANCHORED.name,
- label = stringResource(R.string.epg_mode_anchored),
- supportingText = stringResource(R.string.epg_mode_anchored_hint)
- ),
- SelectionChip(
- key = GuideChannelMode.ARCHIVE_READY.name,
- label = stringResource(R.string.epg_mode_archive),
- supportingText = stringResource(R.string.epg_mode_archive_hint)
- )
- ),
- selectedKey = selectedMode.name,
- onChipSelected = { key ->
- GuideChannelMode.entries
- .firstOrNull { it.name == key }
- ?.let(onModeSelected)
- }
- )
-}
-
-@Composable
-internal fun GuideTimeControlsRow(
- onJumpToPreviousDay: () -> Unit,
- onPageBackward: () -> Unit,
- onJumpBackwardHalfHour: () -> Unit,
- onJumpBackward: () -> Unit,
- onJumpToNow: () -> Unit,
- onJumpForwardHalfHour: () -> Unit,
- onJumpForward: () -> Unit,
- onPageForward: () -> Unit,
- onJumpToPrimeTime: () -> Unit,
- onJumpToTomorrow: () -> Unit,
- onJumpToNextDay: () -> Unit,
- firstChipFocusRequester: FocusRequester? = null,
- contentPadding: PaddingValues = PaddingValues(horizontal = 24.dp, vertical = 12.dp),
- showLabel: Boolean = true
-) {
- Column(
- modifier = Modifier
- .fillMaxWidth()
- .padding(contentPadding)
- ) {
- if (showLabel) {
- Text(
- text = stringResource(R.string.epg_time_controls),
- style = MaterialTheme.typography.labelMedium,
- color = OnSurfaceDim
- )
- Spacer(modifier = Modifier.height(8.dp))
- }
- LazyRow(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
- item {
- LiveGuideShortcutChip(
- modifier = firstChipFocusRequester?.let { Modifier.focusRequester(it) } ?: Modifier,
- label = stringResource(R.string.epg_previous_day),
- onClick = onJumpToPreviousDay
- )
- }
- item { LiveGuideShortcutChip(label = stringResource(R.string.epg_page_back), onClick = onPageBackward) }
- item { LiveGuideShortcutChip(label = stringResource(R.string.epg_jump_back_half_hour), onClick = onJumpBackwardHalfHour) }
- item { LiveGuideShortcutChip(label = stringResource(R.string.epg_jump_back), onClick = onJumpBackward) }
- item { LiveGuideShortcutChip(label = stringResource(R.string.epg_jump_now), onClick = onJumpToNow) }
- item { LiveGuideShortcutChip(label = stringResource(R.string.epg_jump_forward_half_hour), onClick = onJumpForwardHalfHour) }
- item { LiveGuideShortcutChip(label = stringResource(R.string.epg_jump_forward), onClick = onJumpForward) }
- item { LiveGuideShortcutChip(label = stringResource(R.string.epg_page_forward), onClick = onPageForward) }
- item { LiveGuideShortcutChip(label = stringResource(R.string.epg_jump_prime_time), onClick = onJumpToPrimeTime) }
- item { LiveGuideShortcutChip(label = stringResource(R.string.epg_jump_tomorrow), onClick = onJumpToTomorrow) }
- item { LiveGuideShortcutChip(label = stringResource(R.string.epg_next_day), onClick = onJumpToNextDay) }
- }
- }
-}
-
-@Composable
-internal fun GuideDayRow(
- selectedDayStart: Long,
- onDaySelected: (Long) -> Unit,
- contentPadding: PaddingValues = PaddingValues(horizontal = 24.dp, vertical = 4.dp),
- showLabel: Boolean = true
-) {
- val dayFormat = remember { SimpleDateFormat("EEE d MMM", Locale.getDefault()) }
- val dayAnchors = remember(selectedDayStart) {
- (-1L..3L).map { offset ->
- shiftGuideDayStart(selectedDayStart, offset)
- }
- }
-
- Column(
- modifier = Modifier
- .fillMaxWidth()
- .padding(contentPadding)
- ) {
- if (showLabel) {
- Text(
- text = stringResource(R.string.epg_day_selector_label),
- style = MaterialTheme.typography.labelMedium,
- color = OnSurfaceDim
- )
- Spacer(modifier = Modifier.height(8.dp))
- }
- LazyRow(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
- items(dayAnchors, key = { it }) { dayStart ->
- val isSelected = dayStart == selectedDayStart
- TvClickableSurface(
- onClick = { onDaySelected(dayStart) },
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (isSelected) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = 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)
- )
- )
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp),
- verticalArrangement = Arrangement.spacedBy(2.dp)
- ) {
- Text(text = dayRelativeLabel(dayStart), style = MaterialTheme.typography.labelLarge)
- Text(
- text = dayFormat.format(Date(dayStart)),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- }
-}
-
-@Composable
-internal fun GuideViewOptionsRow(
- showScheduledOnly: Boolean,
- onToggleScheduledOnly: () -> Unit
-) {
- Column(
- modifier = Modifier
- .fillMaxWidth()
- .padding(horizontal = 24.dp, vertical = 4.dp)
- ) {
- Text(
- text = stringResource(R.string.epg_view_options_label),
- style = MaterialTheme.typography.labelMedium,
- color = OnSurfaceDim
- )
- Spacer(modifier = Modifier.height(8.dp))
- LazyRow(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
- item {
- TvClickableSurface(
- onClick = onToggleScheduledOnly,
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (showScheduledOnly) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = SurfaceHighlight,
- contentColor = if (showScheduledOnly) 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)
- )
- )
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp),
- verticalArrangement = Arrangement.spacedBy(2.dp)
- ) {
- Text(
- text = stringResource(
- if (showScheduledOnly) R.string.epg_view_scheduled_only_on
- else R.string.epg_view_scheduled_only_off
- ),
- style = MaterialTheme.typography.labelLarge
- )
- Text(
- text = stringResource(R.string.epg_view_scheduled_only_hint),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- }
-}
-
-@Composable
-internal fun GuideFavoritesRow(
- showFavoritesOnly: Boolean,
- onToggleFavoritesOnly: () -> Unit
-) {
- SelectionChipRow(
- title = stringResource(R.string.epg_favorites_filter_title),
- subtitle = stringResource(R.string.epg_favorites_filter_subtitle),
- chips = listOf(
- SelectionChip(
- key = "all",
- label = stringResource(R.string.epg_favorites_filter_all),
- supportingText = stringResource(R.string.epg_favorites_filter_all_hint)
- ),
- SelectionChip(
- key = "favorites",
- label = stringResource(R.string.epg_favorites_filter_favorites),
- supportingText = stringResource(R.string.epg_favorites_filter_favorites_hint)
- )
- ),
- selectedKey = if (showFavoritesOnly) "favorites" else "all",
- onChipSelected = { key ->
- val shouldShowFavorites = key == "favorites"
- if (shouldShowFavorites != showFavoritesOnly) {
- onToggleFavoritesOnly()
- }
- },
- contentPadding = PaddingValues(horizontal = 24.dp)
- )
-}
-
-@Composable
-internal fun startOfDay(timestamp: Long): Long {
- return startOfGuideDay(timestamp)
-}
-
-@Composable
-private fun dayRelativeLabel(dayStart: Long): String {
- val zoneId = remember { ZoneId.systemDefault() }
- val today = remember { LocalDate.now(zoneId) }
- return when (dayRelativeOffset(dayStart, today, zoneId)) {
- -1L -> stringResource(R.string.epg_day_yesterday)
- 0L -> stringResource(R.string.epg_day_today)
- 1L -> stringResource(R.string.epg_day_tomorrow)
- else -> {
- val format = remember { SimpleDateFormat("EEE", Locale.getDefault()) }
- format.format(Date(dayStart))
- }
- }
-}
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.kt
index a4acb4a3..81fd2305 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.kt
@@ -13,6 +13,13 @@ import com.streamvault.feature.live.presentation.epg.LiveGuideCategoryPickerDial
import com.streamvault.feature.live.presentation.epg.LiveGuideCategoryPickerLabels
import com.streamvault.feature.live.presentation.epg.LiveCompactGuideProgramDialog
import com.streamvault.feature.live.presentation.epg.LiveCompactGuideProgramLabels
+import com.streamvault.feature.live.presentation.epg.LiveGuideControlLabels
+import com.streamvault.feature.live.presentation.epg.LiveGuideDayLabels
+import com.streamvault.feature.live.presentation.epg.LiveGuideDensityLabels
+import com.streamvault.feature.live.presentation.epg.LiveGuideFavoritesLabels
+import com.streamvault.feature.live.presentation.epg.LiveGuideModeLabels
+import com.streamvault.feature.live.presentation.epg.LiveGuideTimeControlLabels
+import com.streamvault.feature.live.presentation.epg.LiveGuideViewOptionsLabels
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
@@ -595,6 +602,62 @@ fun FullEpgScreen(
if (showGuideOptions) {
GuideOptionsOverlay(
uiState = uiState,
+ labels = LiveGuideControlLabels(
+ time = LiveGuideTimeControlLabels(
+ section = stringResource(R.string.epg_time_controls),
+ previousDay = stringResource(R.string.epg_previous_day),
+ pageBack = stringResource(R.string.epg_page_back),
+ jumpBackHalfHour = stringResource(R.string.epg_jump_back_half_hour),
+ jumpBack = stringResource(R.string.epg_jump_back),
+ jumpNow = stringResource(R.string.epg_jump_now),
+ jumpForwardHalfHour = stringResource(R.string.epg_jump_forward_half_hour),
+ jumpForward = stringResource(R.string.epg_jump_forward),
+ pageForward = stringResource(R.string.epg_page_forward),
+ jumpPrimeTime = stringResource(R.string.epg_jump_prime_time),
+ jumpTomorrow = stringResource(R.string.epg_jump_tomorrow),
+ nextDay = stringResource(R.string.epg_next_day)
+ ),
+ day = LiveGuideDayLabels(
+ section = stringResource(R.string.epg_day_selector_label),
+ yesterday = stringResource(R.string.epg_day_yesterday),
+ today = stringResource(R.string.epg_day_today),
+ tomorrow = stringResource(R.string.epg_day_tomorrow)
+ ),
+ mode = LiveGuideModeLabels(
+ title = stringResource(R.string.epg_mode_label),
+ subtitle = stringResource(R.string.epg_mode_subtitle),
+ all = stringResource(R.string.epg_mode_all),
+ allHint = stringResource(R.string.epg_mode_all_hint),
+ anchored = stringResource(R.string.epg_mode_anchored),
+ anchoredHint = stringResource(R.string.epg_mode_anchored_hint),
+ archiveReady = stringResource(R.string.epg_mode_archive),
+ archiveReadyHint = stringResource(R.string.epg_mode_archive_hint)
+ ),
+ density = LiveGuideDensityLabels(
+ title = stringResource(R.string.epg_density_label),
+ subtitle = stringResource(R.string.epg_density_subtitle),
+ compact = stringResource(R.string.epg_density_compact),
+ compactHint = stringResource(R.string.epg_density_compact_hint),
+ comfortable = stringResource(R.string.epg_density_comfortable),
+ comfortableHint = stringResource(R.string.epg_density_comfortable_hint),
+ cinematic = stringResource(R.string.epg_density_cinematic),
+ cinematicHint = stringResource(R.string.epg_density_cinematic_hint)
+ ),
+ viewOptions = LiveGuideViewOptionsLabels(
+ title = stringResource(R.string.epg_view_options_label),
+ scheduledOnlyOn = stringResource(R.string.epg_view_scheduled_only_on),
+ scheduledOnlyOff = stringResource(R.string.epg_view_scheduled_only_off),
+ scheduledOnlyHint = stringResource(R.string.epg_view_scheduled_only_hint)
+ ),
+ favorites = LiveGuideFavoritesLabels(
+ title = stringResource(R.string.epg_favorites_filter_title),
+ subtitle = stringResource(R.string.epg_favorites_filter_subtitle),
+ all = stringResource(R.string.epg_favorites_filter_all),
+ allHint = stringResource(R.string.epg_favorites_filter_all_hint),
+ favorites = stringResource(R.string.epg_favorites_filter_favorites),
+ favoritesHint = stringResource(R.string.epg_favorites_filter_favorites_hint)
+ )
+ ),
onDismiss = { showGuideOptions = false },
onShowAppNavigation = {
topNavVisible = true
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreenDialogs.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreenDialogs.kt
index 79c1c70b..6bde67bb 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreenDialogs.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreenDialogs.kt
@@ -31,9 +31,7 @@ import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
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.Modifier
@@ -55,23 +53,25 @@ import androidx.tv.material3.Text
import com.streamvault.app.R
import com.streamvault.feature.live.presentation.epg.GuideChannelMode
import com.streamvault.feature.live.presentation.epg.GuideDensity
+import com.streamvault.feature.live.presentation.epg.LiveGuideControlLabels
+import com.streamvault.feature.live.presentation.epg.LiveGuideDensityRow
+import com.streamvault.feature.live.presentation.epg.LiveGuideDayRow
+import com.streamvault.feature.live.presentation.epg.LiveGuideFavoritesRow
+import com.streamvault.feature.live.presentation.epg.LiveGuideModeRow
+import com.streamvault.feature.live.presentation.epg.LiveGuideTimeControlsRow
+import com.streamvault.feature.live.presentation.epg.LiveGuideViewOptionsRow
+import com.streamvault.feature.live.presentation.epg.startOfGuideDay
import com.streamvault.core.ui.interaction.TvClickableSurface
import com.streamvault.core.ui.interaction.TvButton
-import com.streamvault.feature.live.presentation.time.LocalLiveTimeFormat
-import com.streamvault.feature.live.presentation.time.createLiveTimeFormat
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.domain.model.Category
-import com.streamvault.domain.model.Channel
import com.streamvault.domain.model.EpgMatchType
import com.streamvault.domain.model.EpgOverrideCandidate
import com.streamvault.domain.model.EpgSourceType
-import com.streamvault.domain.model.Program
-import java.util.Date
@Composable
private fun GuideModalDialog(
@@ -109,6 +109,7 @@ private fun GuideModalDialog(
@Composable
internal fun GuideOptionsOverlay(
uiState: EpgUiState,
+ labels: LiveGuideControlLabels,
onDismiss: () -> Unit,
onShowAppNavigation: () -> Unit,
onJumpToPreviousDay: () -> Unit,
@@ -173,7 +174,8 @@ internal fun GuideOptionsOverlay(
)
}
}
- GuideTimeControlsRow(
+ LiveGuideTimeControlsRow(
+ labels = labels.time,
onJumpToPreviousDay = onJumpToPreviousDay,
onPageBackward = onPageBackward,
onJumpBackwardHalfHour = onJumpBackwardHalfHour,
@@ -187,24 +189,29 @@ internal fun GuideOptionsOverlay(
onJumpToNextDay = onJumpToNextDay,
firstChipFocusRequester = optionsFocusRequester
)
- GuideDayRow(
- selectedDayStart = startOfDay(uiState.guideWindowStart + EpgViewModel.LOOKBACK_MS),
+ LiveGuideDayRow(
+ selectedDayStart = startOfGuideDay(uiState.guideWindowStart + EpgViewModel.LOOKBACK_MS),
+ labels = labels.day,
onDaySelected = onDaySelected
)
- GuideModeRow(
+ LiveGuideModeRow(
selectedMode = uiState.selectedChannelMode,
+ labels = labels.mode,
onModeSelected = onModeSelected
)
- GuideDensityRow(
+ LiveGuideDensityRow(
selectedDensity = uiState.selectedDensity,
+ labels = labels.density,
onDensitySelected = onDensitySelected
)
- GuideViewOptionsRow(
+ LiveGuideViewOptionsRow(
showScheduledOnly = uiState.showScheduledOnly,
+ labels = labels.viewOptions,
onToggleScheduledOnly = onToggleScheduledOnly
)
- GuideFavoritesRow(
+ LiveGuideFavoritesRow(
showFavoritesOnly = uiState.showFavoritesOnly,
+ labels = labels.favorites,
onToggleFavoritesOnly = onToggleFavoritesOnly
)
Row(
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
index fe9b0205..abacb2f1 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
@@ -136,7 +136,8 @@ header, channel-content state host, channel-list host, and category-list host
and hidden category/channel dialogs, the category options dialog, the
quick-filter add dialog, delete-group dialog, rename-group dialog, M3U category
organizer dialog, M3U series-assignment dialogs, EPG search overlay, guide
-category picker, and compact guide-program dialog are now feature-owned
+category picker, compact guide-program dialog, and the guide control rows are
+now feature-owned
while the Home and EPG
screen/dialog composition remains in `:app` for the remaining app-specific
dialogs.
@@ -147,6 +148,6 @@ mode/density/reminder presentation models, hidden collection dialogs, the
category options dialog, the quick-filter add dialog, the delete-group dialog,
and the rename-group dialog, M3U category organizer dialog, and M3U
series-assignment dialogs, the EPG search overlay, guide category picker, and
-compact guide-program dialog are independent of app code;
+compact guide-program dialog and guide control rows are independent of app code;
screen/resource moves, golden/runtime/performance gates, and legacy app cleanup
remain open, so no live slice acceptance gate is claimed yet.
diff --git a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
index b8363fda..db147bfa 100644
--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
@@ -26,7 +26,8 @@ header, channel-content state host, channel-list host, and category-list host
and hidden category/channel dialogs, the category options dialog, the
quick-filter add dialog, delete-group dialog, rename-group dialog, M3U category
organizer dialog, M3U series-assignment dialogs, EPG search overlay, guide
-category picker, and compact guide-program dialog are now feature-owned
+category picker, compact guide-program dialog, and guide control rows are now
+feature-owned
and their feature checks are green. Home screen/dialog composition, the
remaining live cards/rows, complete locale resource migration, and acceptance
gates remain open.
@@ -699,6 +700,9 @@ row presentation while the app supplies lock policy and callbacks. The compact
guide-program dialog now owns modal/program presentation, timing/progress,
details state, focus, and action affordances while the app supplies labels and
playback/recording callbacks.
+The guide control rows (time paging, day selection, mode, density, view, and
+favorites) are also feature-owned; the options shell continues to supply labels
+and ViewModel callbacks from `:app`.
quick-filter key/selection rules are covered by `LiveQuickFiltersTest`. The
remaining app-owned live cards and shell/dialog composition still require
compatibility seams before the full Home move.
diff --git a/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideControlComponents.kt b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideControlComponents.kt
new file mode 100644
index 00000000..21b06be8
--- /dev/null
+++ b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideControlComponents.kt
@@ -0,0 +1,301 @@
+package com.streamvault.feature.live.presentation.epg
+
+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.Spacer
+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.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.focus.FocusRequester
+import androidx.compose.ui.focus.focusRequester
+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.Text
+import com.streamvault.core.ui.interaction.TvClickableSurface
+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.feature.live.presentation.components.LiveSelectionChip
+import com.streamvault.feature.live.presentation.components.LiveSelectionChipRow
+import java.text.SimpleDateFormat
+import java.time.LocalDate
+import java.time.ZoneId
+import java.util.Date
+import java.util.Locale
+
+data class LiveGuideTimeControlLabels(
+ val section: String,
+ val previousDay: String,
+ val pageBack: String,
+ val jumpBackHalfHour: String,
+ val jumpBack: String,
+ val jumpNow: String,
+ val jumpForwardHalfHour: String,
+ val jumpForward: String,
+ val pageForward: String,
+ val jumpPrimeTime: String,
+ val jumpTomorrow: String,
+ val nextDay: String
+)
+
+data class LiveGuideDayLabels(
+ val section: String,
+ val yesterday: String,
+ val today: String,
+ val tomorrow: String
+)
+
+data class LiveGuideModeLabels(
+ val title: String,
+ val subtitle: String,
+ val all: String,
+ val allHint: String,
+ val anchored: String,
+ val anchoredHint: String,
+ val archiveReady: String,
+ val archiveReadyHint: String
+)
+
+data class LiveGuideDensityLabels(
+ val title: String,
+ val subtitle: String,
+ val compact: String,
+ val compactHint: String,
+ val comfortable: String,
+ val comfortableHint: String,
+ val cinematic: String,
+ val cinematicHint: String
+)
+
+data class LiveGuideViewOptionsLabels(
+ val title: String,
+ val scheduledOnlyOn: String,
+ val scheduledOnlyOff: String,
+ val scheduledOnlyHint: String
+)
+
+data class LiveGuideFavoritesLabels(
+ val title: String,
+ val subtitle: String,
+ val all: String,
+ val allHint: String,
+ val favorites: String,
+ val favoritesHint: String
+)
+
+data class LiveGuideControlLabels(
+ val time: LiveGuideTimeControlLabels,
+ val day: LiveGuideDayLabels,
+ val mode: LiveGuideModeLabels,
+ val density: LiveGuideDensityLabels,
+ val viewOptions: LiveGuideViewOptionsLabels,
+ val favorites: LiveGuideFavoritesLabels
+)
+
+@Composable
+fun LiveGuideDensityRow(
+ selectedDensity: GuideDensity,
+ labels: LiveGuideDensityLabels,
+ onDensitySelected: (GuideDensity) -> Unit
+) {
+ LiveSelectionChipRow(
+ title = labels.title,
+ subtitle = labels.subtitle,
+ chips = listOf(
+ LiveSelectionChip(GuideDensity.COMPACT.name, labels.compact, labels.compactHint),
+ LiveSelectionChip(GuideDensity.COMFORTABLE.name, labels.comfortable, labels.comfortableHint),
+ LiveSelectionChip(GuideDensity.CINEMATIC.name, labels.cinematic, labels.cinematicHint)
+ ),
+ selectedKey = selectedDensity.name,
+ onChipSelected = { key -> GuideDensity.entries.firstOrNull { it.name == key }?.let(onDensitySelected) }
+ )
+}
+
+@Composable
+fun LiveGuideModeRow(
+ selectedMode: GuideChannelMode,
+ labels: LiveGuideModeLabels,
+ onModeSelected: (GuideChannelMode) -> Unit
+) {
+ LiveSelectionChipRow(
+ title = labels.title,
+ subtitle = labels.subtitle,
+ chips = listOf(
+ LiveSelectionChip(GuideChannelMode.ALL.name, labels.all, labels.allHint),
+ LiveSelectionChip(GuideChannelMode.ANCHORED.name, labels.anchored, labels.anchoredHint),
+ LiveSelectionChip(GuideChannelMode.ARCHIVE_READY.name, labels.archiveReady, labels.archiveReadyHint)
+ ),
+ selectedKey = selectedMode.name,
+ onChipSelected = { key -> GuideChannelMode.entries.firstOrNull { it.name == key }?.let(onModeSelected) }
+ )
+}
+
+@Composable
+fun LiveGuideTimeControlsRow(
+ labels: LiveGuideTimeControlLabels,
+ onJumpToPreviousDay: () -> Unit,
+ onPageBackward: () -> Unit,
+ onJumpBackwardHalfHour: () -> Unit,
+ onJumpBackward: () -> Unit,
+ onJumpToNow: () -> Unit,
+ onJumpForwardHalfHour: () -> Unit,
+ onJumpForward: () -> Unit,
+ onPageForward: () -> Unit,
+ onJumpToPrimeTime: () -> Unit,
+ onJumpToTomorrow: () -> Unit,
+ onJumpToNextDay: () -> Unit,
+ firstChipFocusRequester: FocusRequester? = null,
+ contentPadding: PaddingValues = PaddingValues(horizontal = 24.dp, vertical = 12.dp),
+ showLabel: Boolean = true
+) {
+ Column(modifier = Modifier.fillMaxWidth().padding(contentPadding)) {
+ if (showLabel) {
+ Text(text = labels.section, style = MaterialTheme.typography.labelMedium, color = OnSurfaceDim)
+ Spacer(modifier = Modifier.height(8.dp))
+ }
+ LazyRow(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
+ item { LiveGuideShortcutChip(modifier = firstChipFocusRequester?.let { Modifier.focusRequester(it) } ?: Modifier, label = labels.previousDay, onClick = onJumpToPreviousDay) }
+ item { LiveGuideShortcutChip(label = labels.pageBack, onClick = onPageBackward) }
+ item { LiveGuideShortcutChip(label = labels.jumpBackHalfHour, onClick = onJumpBackwardHalfHour) }
+ item { LiveGuideShortcutChip(label = labels.jumpBack, onClick = onJumpBackward) }
+ item { LiveGuideShortcutChip(label = labels.jumpNow, onClick = onJumpToNow) }
+ item { LiveGuideShortcutChip(label = labels.jumpForwardHalfHour, onClick = onJumpForwardHalfHour) }
+ item { LiveGuideShortcutChip(label = labels.jumpForward, onClick = onJumpForward) }
+ item { LiveGuideShortcutChip(label = labels.pageForward, onClick = onPageForward) }
+ item { LiveGuideShortcutChip(label = labels.jumpPrimeTime, onClick = onJumpToPrimeTime) }
+ item { LiveGuideShortcutChip(label = labels.jumpTomorrow, onClick = onJumpToTomorrow) }
+ item { LiveGuideShortcutChip(label = labels.nextDay, onClick = onJumpToNextDay) }
+ }
+ }
+}
+
+@Composable
+fun LiveGuideDayRow(
+ selectedDayStart: Long,
+ labels: LiveGuideDayLabels,
+ onDaySelected: (Long) -> Unit,
+ contentPadding: PaddingValues = PaddingValues(horizontal = 24.dp, vertical = 4.dp),
+ showLabel: Boolean = true
+) {
+ val dayFormat = remember { SimpleDateFormat("EEE d MMM", Locale.getDefault()) }
+ val dayAnchors = remember(selectedDayStart) { (-1L..3L).map { shiftGuideDayStart(selectedDayStart, it) } }
+ Column(modifier = Modifier.fillMaxWidth().padding(contentPadding)) {
+ if (showLabel) {
+ Text(text = labels.section, style = MaterialTheme.typography.labelMedium, color = OnSurfaceDim)
+ Spacer(modifier = Modifier.height(8.dp))
+ }
+ LazyRow(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
+ items(dayAnchors, key = { it }) { dayStart ->
+ val isSelected = dayStart == selectedDayStart
+ TvClickableSurface(
+ onClick = { onDaySelected(dayStart) },
+ colors = ClickableSurfaceDefaults.colors(
+ containerColor = if (isSelected) Primary.copy(alpha = 0.18f) else SurfaceElevated,
+ focusedContainerColor = 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)
+ )
+ )
+ ) {
+ Column(modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp), verticalArrangement = Arrangement.spacedBy(2.dp)) {
+ Text(text = dayRelativeLabel(dayStart, labels), style = MaterialTheme.typography.labelLarge)
+ Text(text = dayFormat.format(Date(dayStart)), style = MaterialTheme.typography.bodySmall, color = OnSurfaceDim)
+ }
+ }
+ }
+ }
+ }
+}
+
+@Composable
+fun LiveGuideViewOptionsRow(
+ showScheduledOnly: Boolean,
+ labels: LiveGuideViewOptionsLabels,
+ onToggleScheduledOnly: () -> Unit
+) {
+ Column(modifier = Modifier.fillMaxWidth().padding(horizontal = 24.dp, vertical = 4.dp)) {
+ Text(text = labels.title, style = MaterialTheme.typography.labelMedium, color = OnSurfaceDim)
+ Spacer(modifier = Modifier.height(8.dp))
+ LazyRow(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
+ item {
+ TvClickableSurface(
+ onClick = onToggleScheduledOnly,
+ colors = ClickableSurfaceDefaults.colors(
+ containerColor = if (showScheduledOnly) Primary.copy(alpha = 0.18f) else SurfaceElevated,
+ focusedContainerColor = SurfaceHighlight,
+ contentColor = if (showScheduledOnly) 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)
+ )
+ )
+ ) {
+ Column(modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp), verticalArrangement = Arrangement.spacedBy(2.dp)) {
+ Text(text = if (showScheduledOnly) labels.scheduledOnlyOn else labels.scheduledOnlyOff, style = MaterialTheme.typography.labelLarge)
+ Text(text = labels.scheduledOnlyHint, style = MaterialTheme.typography.bodySmall, color = OnSurfaceDim)
+ }
+ }
+ }
+ }
+ }
+}
+
+@Composable
+fun LiveGuideFavoritesRow(
+ showFavoritesOnly: Boolean,
+ labels: LiveGuideFavoritesLabels,
+ onToggleFavoritesOnly: () -> Unit
+) {
+ LiveSelectionChipRow(
+ title = labels.title,
+ subtitle = labels.subtitle,
+ chips = listOf(
+ LiveSelectionChip("all", labels.all, labels.allHint),
+ LiveSelectionChip("favorites", labels.favorites, labels.favoritesHint)
+ ),
+ selectedKey = if (showFavoritesOnly) "favorites" else "all",
+ onChipSelected = { key ->
+ val shouldShowFavorites = key == "favorites"
+ if (shouldShowFavorites != showFavoritesOnly) onToggleFavoritesOnly()
+ },
+ contentPadding = PaddingValues(horizontal = 24.dp)
+ )
+}
+
+@Composable
+private fun dayRelativeLabel(dayStart: Long, labels: LiveGuideDayLabels): String {
+ val zoneId = remember { ZoneId.systemDefault() }
+ val today = remember { LocalDate.now(zoneId) }
+ return when (dayRelativeOffset(dayStart, today, zoneId)) {
+ -1L -> labels.yesterday
+ 0L -> labels.today
+ 1L -> labels.tomorrow
+ else -> remember { SimpleDateFormat("EEE", Locale.getDefault()) }.format(Date(dayStart))
+ }
+}