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 EPG shortcut chip

David Nashashc84b01dadb34
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
index 32db416d..c297e00a 100644
--- 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
@@ -64,6 +64,7 @@ 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
@@ -200,7 +201,7 @@ internal fun GuideProgramSearchRow(
)
Box(modifier = Modifier.widthIn(min = 104.dp), contentAlignment = Alignment.CenterEnd) {
if (localQuery.isNotBlank()) {
- GuideShortcutChip(
+ LiveGuideShortcutChip(
label = stringResource(R.string.epg_clear_search),
onClick = {
localQuery = ""
@@ -500,22 +501,22 @@ internal fun GuideTimeControlsRow(
}
LazyRow(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
item {
- GuideShortcutChip(
+ LiveGuideShortcutChip(
modifier = firstChipFocusRequester?.let { Modifier.focusRequester(it) } ?: Modifier,
label = stringResource(R.string.epg_previous_day),
onClick = onJumpToPreviousDay
)
}
- item { GuideShortcutChip(label = stringResource(R.string.epg_page_back), onClick = onPageBackward) }
- item { GuideShortcutChip(label = stringResource(R.string.epg_jump_back_half_hour), onClick = onJumpBackwardHalfHour) }
- item { GuideShortcutChip(label = stringResource(R.string.epg_jump_back), onClick = onJumpBackward) }
- item { GuideShortcutChip(label = stringResource(R.string.epg_jump_now), onClick = onJumpToNow) }
- item { GuideShortcutChip(label = stringResource(R.string.epg_jump_forward_half_hour), onClick = onJumpForwardHalfHour) }
- item { GuideShortcutChip(label = stringResource(R.string.epg_jump_forward), onClick = onJumpForward) }
- item { GuideShortcutChip(label = stringResource(R.string.epg_page_forward), onClick = onPageForward) }
- item { GuideShortcutChip(label = stringResource(R.string.epg_jump_prime_time), onClick = onJumpToPrimeTime) }
- item { GuideShortcutChip(label = stringResource(R.string.epg_jump_tomorrow), onClick = onJumpToTomorrow) }
- item { GuideShortcutChip(label = stringResource(R.string.epg_next_day), onClick = onJumpToNextDay) }
+ 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) }
}
}
}
@@ -672,39 +673,6 @@ internal fun GuideFavoritesRow(
}
@Composable
-internal fun GuideShortcutChip(
- modifier: Modifier = Modifier,
- label: String,
- onClick: () -> Unit,
- isSelected: Boolean = false
-) {
- TvClickableSurface(
- onClick = onClick,
- modifier = modifier,
- 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)
- )
- )
- ) {
- Text(
- text = label,
- modifier = Modifier.padding(horizontal = 12.dp, vertical = 7.dp),
- style = MaterialTheme.typography.labelMedium,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- }
-}
-
internal fun startOfDay(timestamp: Long): Long {
return startOfGuideDay(timestamp)
}
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 63ba881d..81a83c41 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
@@ -1,5 +1,6 @@
package com.streamvault.app.ui.screens.epg
+import com.streamvault.feature.live.presentation.epg.LiveGuideShortcutChip
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
@@ -155,11 +156,11 @@ internal fun GuideSearchOverlay(
color = OnSurface
)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
- GuideShortcutChip(
+ LiveGuideShortcutChip(
label = stringResource(R.string.epg_search_apply),
onClick = { applySearchAndClose(query.trim()) }
)
- GuideShortcutChip(
+ LiveGuideShortcutChip(
label = stringResource(R.string.epg_clear_search_close),
onClick = clearAndClose
)
@@ -237,11 +238,11 @@ internal fun GuideOptionsOverlay(
color = OnSurface
)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
- GuideShortcutChip(
+ LiveGuideShortcutChip(
label = stringResource(R.string.epg_show_app_navigation),
onClick = onShowAppNavigation
)
- GuideShortcutChip(
+ LiveGuideShortcutChip(
label = stringResource(R.string.settings_cancel),
onClick = onDismiss
)
@@ -288,12 +289,12 @@ internal fun GuideOptionsOverlay(
horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)
) {
if (onManageEpgMatch != null) {
- GuideShortcutChip(
+ LiveGuideShortcutChip(
label = stringResource(R.string.epg_override_manage),
onClick = onManageEpgMatch
)
}
- GuideShortcutChip(
+ LiveGuideShortcutChip(
label = stringResource(R.string.epg_refresh_guide),
onClick = onRefresh
)
@@ -752,7 +753,7 @@ internal fun GuideCategoryPickerDialog(
color = OnSurfaceDim
)
}
- GuideShortcutChip(
+ LiveGuideShortcutChip(
label = stringResource(R.string.settings_cancel),
onClick = onDismiss
)
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
index d47eb788..40c6fe3b 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
@@ -129,8 +129,9 @@ The `:feature:live` module itself depends only on `:core:navigation`, `:core:ui`
feature-to-feature imports. Home and Guide ViewModels are being moved behind
the live boundary incrementally: `HomeViewModel`, the sidebar/preview surface,
the loading/preview host supporting composables, the live source switcher, Home
-quick-filter panel/chip row, Home reorder top bar, and Home channel row surface
-are now feature-owned while the Home screen/dialog composition remains in `:app`.
+quick-filter panel/chip row, the reusable EPG guide shortcut chip, Home reorder
+top bar, and Home channel row surface are now feature-owned while the Home and
+EPG screen/dialog composition remains in `:app`.
The source switcher receives localized labels from the app at the current
composition boundary. Live-owned
presentation primitives, `HomeUiState`, `HomePreviewUiState`, and Guide
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 6383ec8e..f5156afa 100644
--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
@@ -19,8 +19,8 @@ claim the Live slice or Phase 5 complete.
Status update (2026-08-29): `HomeViewModel`, the sidebar/preview surface, the
loading/preview host supporting composables, the live source switcher, Home
-quick-filter panel/chip row, Home reorder top bar, and Home channel row surface
-are now feature-owned
+quick-filter panel/chip row, the reusable EPG guide shortcut chip, Home reorder
+top bar, and Home channel row surface 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.
@@ -656,7 +656,8 @@ Move `HomeScreen.kt`, `HomeScreenDialogs.kt`, and `HomeSidebarComponents.kt`. Re
The first screen wiring checkpoint is complete: Home now calls the
feature-owned `LiveSourceSwitcher`, `LiveQuickFiltersPanel` (including its
-`LiveSelectionChipRow`), `LiveReorderTopBar`, and `LiveChannelRowSurface`,
+`LiveSelectionChipRow`), `LiveGuideShortcutChip`, `LiveReorderTopBar`, and
+`LiveChannelRowSurface`,
passing app-localized labels/title formatting/accessibility text through
explicit presentation parameters. The quick-filter key/selection rules are
covered by `LiveQuickFiltersTest`. The remaining app-owned live cards and
diff --git a/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideShortcutChip.kt b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideShortcutChip.kt
new file mode 100644
index 00000000..9d536216
--- /dev/null
+++ b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideShortcutChip.kt
@@ -0,0 +1,52 @@
+package com.streamvault.feature.live.presentation.epg
+
+import androidx.compose.foundation.BorderStroke
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+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.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.Primary
+import com.streamvault.core.ui.theme.SurfaceElevated
+import com.streamvault.core.ui.theme.SurfaceHighlight
+
+@Composable
+fun LiveGuideShortcutChip(
+ modifier: Modifier = Modifier,
+ label: String,
+ onClick: () -> Unit,
+ isSelected: Boolean = false
+) {
+ TvClickableSurface(
+ onClick = onClick,
+ modifier = modifier,
+ 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)
+ )
+ )
+ ) {
+ Text(
+ text = label,
+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 7.dp),
+ style = androidx.tv.material3.MaterialTheme.typography.labelMedium,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis
+ )
+ }
+}