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 guide toolbar

David Nashashdeed02dd66e3
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgHeroComponents.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgHeroComponents.kt
index 24f0dc6b..55ff8f7d 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgHeroComponents.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgHeroComponents.kt
@@ -1,6 +1,5 @@
package com.streamvault.app.ui.screens.epg
-import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
@@ -17,20 +16,16 @@ import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
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.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
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
@@ -40,11 +35,9 @@ import com.streamvault.feature.live.presentation.epg.GuideDensity
import com.streamvault.feature.live.presentation.epg.currentLiveGuideNow
import com.streamvault.core.ui.image.ChannelLogoBadge
import com.streamvault.domain.playback.isArchivePlayable
-import com.streamvault.core.ui.interaction.TvClickableSurface
import com.streamvault.feature.live.presentation.model.guideLookupKey
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
@@ -120,7 +113,6 @@ internal fun GuideHeroSection(
modifier = modifier
)
}
-
@Composable
internal fun ImmersiveGuideHero(
selection: GuideHeroSelection?,
@@ -298,79 +290,3 @@ internal fun GuideHeroBadge(
)
}
}
-
-@Composable
-internal fun GuideToolbarRow(
- selectedCategoryName: String,
- onOpenCategoryPicker: () -> Unit,
- onJumpToNow: () -> Unit,
- onOpenSearch: () -> Unit,
- onOpenOptions: () -> Unit,
- onGuideInteract: () -> Unit,
- modifier: Modifier = Modifier
-) {
- Row(
- modifier = modifier,
- horizontalArrangement = Arrangement.spacedBy(5.dp),
- verticalAlignment = Alignment.CenterVertically
- ) {
- GuideToolbarButton(
- label = selectedCategoryName,
- modifier = Modifier.widthIn(min = 200.dp, max = 280.dp),
- onClick = onOpenCategoryPicker,
- onFocused = onGuideInteract
- )
- GuideToolbarButton(
- label = stringResource(R.string.epg_jump_now),
- onClick = onJumpToNow,
- onFocused = onGuideInteract
- )
- GuideToolbarButton(
- label = stringResource(R.string.epg_search_label),
- onClick = onOpenSearch,
- onFocused = onGuideInteract
- )
- GuideToolbarButton(
- label = stringResource(R.string.epg_options_short),
- onClick = onOpenOptions,
- onFocused = onGuideInteract
- )
- }
-}
-
-@Composable
-internal fun GuideToolbarButton(
- label: String,
- modifier: Modifier = Modifier,
- onClick: () -> Unit,
- onFocused: () -> Unit
-) {
- var focused by remember { mutableStateOf(false) }
- TvClickableSurface(
- onClick = onClick,
- modifier = modifier.onFocusChanged {
- if (it.isFocused && !focused) onFocused()
- focused = it.isFocused
- },
- colors = ClickableSurfaceDefaults.colors(
- containerColor = SurfaceElevated,
- focusedContainerColor = SurfaceHighlight
- ),
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- border = ClickableSurfaceDefaults.border(
- focusedBorder = Border(
- border = BorderStroke(2.dp, FocusBorder),
- shape = RoundedCornerShape(14.dp)
- )
- )
- ) {
- Text(
- text = label,
- modifier = Modifier.padding(horizontal = 11.dp, vertical = 7.dp),
- style = MaterialTheme.typography.labelMedium,
- color = OnSurface,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis
- )
- }
-}
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 9820b26c..fb10249f 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
@@ -22,6 +22,8 @@ import com.streamvault.feature.live.presentation.epg.LiveGuideTimeControlLabels
import com.streamvault.feature.live.presentation.epg.LiveGuideViewOptionsLabels
import com.streamvault.feature.live.presentation.epg.LiveGuidePreviewLabels
import com.streamvault.feature.live.presentation.epg.LiveGuidePreviewPane
+import com.streamvault.feature.live.presentation.epg.LiveGuideToolbarLabels
+import com.streamvault.feature.live.presentation.epg.LiveGuideToolbarRow
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
@@ -450,11 +452,16 @@ fun FullEpgScreen(
.padding(horizontal = 14.dp, vertical = 4.dp)
)
}
- GuideToolbarRow(
+ LiveGuideToolbarRow(
selectedCategoryName = uiState.categories
.firstOrNull { it.id == uiState.selectedCategoryId }
?.name
?: stringResource(R.string.epg_filter_short),
+ labels = LiveGuideToolbarLabels(
+ jumpNow = stringResource(R.string.epg_jump_now),
+ search = stringResource(R.string.epg_search_label),
+ options = stringResource(R.string.epg_options_short)
+ ),
onOpenCategoryPicker = {
showCategoryPicker = true
},
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/PlayerTransparentGuideOverlay.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/PlayerTransparentGuideOverlay.kt
index 95a448e0..4d5d2557 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/PlayerTransparentGuideOverlay.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/PlayerTransparentGuideOverlay.kt
@@ -41,7 +41,7 @@ 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.app.ui.screens.epg.GuideToolbarButton
+import com.streamvault.feature.live.presentation.epg.LiveGuideToolbarButton
import com.streamvault.feature.live.presentation.epg.currentLiveGuideNow
import com.streamvault.app.ui.screens.epg.isGuideCategoryLocked
import com.streamvault.core.ui.theme.OnSurfaceDim
@@ -171,23 +171,23 @@ fun PlayerTransparentGuideOverlay(
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically
) {
- GuideToolbarButton(
+ LiveGuideToolbarButton(
label = selectedCategoryName.ifBlank { stringResource(R.string.epg_filter_short) },
modifier = Modifier.widthIn(min = 180.dp, max = 280.dp),
onClick = { showCategoryPicker = true },
onFocused = {}
)
- GuideToolbarButton(
+ LiveGuideToolbarButton(
label = stringResource(R.string.epg_jump_now),
onClick = onJumpToNow,
onFocused = {}
)
- GuideToolbarButton(
+ LiveGuideToolbarButton(
label = stringResource(R.string.epg_search_label),
onClick = { showSearchOverlay = true },
onFocused = {}
)
- GuideToolbarButton(
+ LiveGuideToolbarButton(
label = stringResource(R.string.settings_cancel),
onClick = onDismiss,
onFocused = {}
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
index 1a6a0bd2..2b7f7a78 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
@@ -136,8 +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, compact guide-program dialog, guide control rows, and EPG
-preview pane are now feature-owned
+category picker, compact guide-program dialog, guide control rows, EPG preview
+pane, and guide toolbar are now feature-owned
while the Home and EPG
screen/dialog composition remains in `:app` for the remaining app-specific
dialogs.
@@ -148,7 +148,7 @@ 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, guide control rows, and EPG preview pane are
-independent of app code;
+compact guide-program dialog, guide control rows, EPG preview pane, and guide
+toolbar 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 2d1b5e5d..456cd4a6 100644
--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
@@ -26,8 +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, compact guide-program dialog, guide control rows, and EPG
-preview pane are now feature-owned
+category picker, compact guide-program dialog, guide control rows, EPG preview
+pane, and guide toolbar 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.
@@ -705,6 +705,8 @@ favorites) are also feature-owned; the options shell continues to supply labels
and ViewModel callbacks from `:app`. The preview pane owns render-surface
selection, placeholder/loading states, channel/program metadata, and progress
presentation while the app supplies the player and focused data.
+The guide toolbar owns button layout and focus affordances while the app
+supplies category text and navigation callbacks.
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/LiveGuideToolbar.kt b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideToolbar.kt
new file mode 100644
index 00000000..6ee396a6
--- /dev/null
+++ b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideToolbar.kt
@@ -0,0 +1,99 @@
+package com.streamvault.feature.live.presentation.epg
+
+import androidx.compose.foundation.BorderStroke
+import androidx.compose.foundation.layout.Arrangement
+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.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.Alignment
+import androidx.compose.ui.focus.onFocusChanged
+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.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.SurfaceElevated
+import com.streamvault.core.ui.theme.SurfaceHighlight
+
+data class LiveGuideToolbarLabels(
+ val jumpNow: String,
+ val search: String,
+ val options: String
+)
+
+@Composable
+fun LiveGuideToolbarRow(
+ selectedCategoryName: String,
+ labels: LiveGuideToolbarLabels,
+ onOpenCategoryPicker: () -> Unit,
+ onJumpToNow: () -> Unit,
+ onOpenSearch: () -> Unit,
+ onOpenOptions: () -> Unit,
+ onGuideInteract: () -> Unit,
+ modifier: Modifier = Modifier
+) {
+ Row(
+ modifier = modifier,
+ horizontalArrangement = Arrangement.spacedBy(5.dp),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ LiveGuideToolbarButton(
+ label = selectedCategoryName,
+ modifier = Modifier.widthIn(min = 200.dp, max = 280.dp),
+ onClick = onOpenCategoryPicker,
+ onFocused = onGuideInteract
+ )
+ LiveGuideToolbarButton(label = labels.jumpNow, onClick = onJumpToNow, onFocused = onGuideInteract)
+ LiveGuideToolbarButton(label = labels.search, onClick = onOpenSearch, onFocused = onGuideInteract)
+ LiveGuideToolbarButton(label = labels.options, onClick = onOpenOptions, onFocused = onGuideInteract)
+ }
+}
+
+@Composable
+fun LiveGuideToolbarButton(
+ label: String,
+ modifier: Modifier = Modifier,
+ onClick: () -> Unit,
+ onFocused: () -> Unit
+) {
+ var focused by remember { mutableStateOf(false) }
+ TvClickableSurface(
+ onClick = onClick,
+ modifier = modifier.onFocusChanged {
+ if (it.isFocused && !focused) onFocused()
+ focused = it.isFocused
+ },
+ colors = ClickableSurfaceDefaults.colors(
+ containerColor = SurfaceElevated,
+ focusedContainerColor = SurfaceHighlight
+ ),
+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
+ border = ClickableSurfaceDefaults.border(
+ focusedBorder = Border(
+ border = BorderStroke(2.dp, FocusBorder),
+ shape = RoundedCornerShape(14.dp)
+ )
+ )
+ ) {
+ Text(
+ text = label,
+ modifier = Modifier.padding(horizontal = 11.dp, vertical = 7.dp),
+ style = MaterialTheme.typography.labelMedium,
+ color = OnSurface,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis
+ )
+ }
+}