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 search overlay

David Nashashb6cbe0900772
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 b76b90d3..6d89677d 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
@@ -7,6 +7,8 @@ import com.streamvault.domain.playback.isArchivePlayable
import com.streamvault.feature.live.presentation.model.guideLookupKey
import com.streamvault.feature.live.presentation.epg.LiveGuideNowProvider
import com.streamvault.feature.live.presentation.epg.currentLiveGuideNow
+import com.streamvault.feature.live.presentation.epg.LiveGuideSearchOverlay
+import com.streamvault.feature.live.presentation.epg.LiveGuideSearchOverlayLabels
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
@@ -558,8 +560,15 @@ fun FullEpgScreen(
}
if (showSearchOverlay) {
- GuideSearchOverlay(
+ LiveGuideSearchOverlay(
query = uiState.programSearchQuery,
+ labels = LiveGuideSearchOverlayLabels(
+ title = stringResource(R.string.epg_search_label),
+ apply = stringResource(R.string.epg_search_apply),
+ clearAndClose = stringResource(R.string.epg_clear_search_close),
+ searchPlaceholder = stringResource(R.string.epg_search_placeholder),
+ clear = stringResource(R.string.epg_clear_search)
+ ),
onQueryChange = viewModel::updateProgramSearchQuery,
onClear = viewModel::clearProgramSearch,
onDismiss = {
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 a052df2a..333d9658 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
@@ -106,86 +106,6 @@ private fun GuideModalDialog(
}
}
-@Composable
-internal fun GuideSearchOverlay(
- query: String,
- onQueryChange: (String) -> Unit,
- onClear: () -> Unit,
- onDismiss: () -> Unit
-) {
- val searchFocusRequester = remember { FocusRequester() }
- val applySearchAndClose = remember(onQueryChange, onDismiss) {
- { submittedQuery: String ->
- onQueryChange(submittedQuery)
- onDismiss()
- }
- }
- val clearAndClose = remember(onClear, onDismiss) {
- {
- onClear()
- onDismiss()
- }
- }
-
- LaunchedEffect(Unit) {
- searchFocusRequester.requestFocus()
- }
-
- GuideModalDialog(
- onDismiss = onDismiss,
- contentAlignment = Alignment.TopCenter
- ) {
- Surface(
- modifier = Modifier
- .fillMaxWidth(0.72f)
- .padding(top = 32.dp)
- .focusGroup(),
- colors = SurfaceDefaults.colors(containerColor = SurfaceElevated),
- shape = RoundedCornerShape(18.dp)
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 18.dp, vertical = 16.dp),
- verticalArrangement = Arrangement.spacedBy(12.dp)
- ) {
- Row(
- modifier = Modifier.fillMaxWidth(),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically
- ) {
- Text(
- text = stringResource(R.string.epg_search_label),
- style = MaterialTheme.typography.titleLarge,
- color = OnSurface
- )
- Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
- LiveGuideShortcutChip(
- label = stringResource(R.string.epg_search_apply),
- onClick = { applySearchAndClose(query.trim()) }
- )
- LiveGuideShortcutChip(
- label = stringResource(R.string.epg_clear_search_close),
- onClick = clearAndClose
- )
- }
- }
- LiveGuideProgramSearchRow(
- query = query,
- onQueryChange = onQueryChange,
- onClear = onClear,
- searchLabel = stringResource(R.string.epg_search_label),
- searchPlaceholder = stringResource(R.string.epg_search_placeholder),
- clearLabel = stringResource(R.string.epg_clear_search),
- onSearch = applySearchAndClose,
- focusRequester = searchFocusRequester,
- autoRequestFocus = true,
- contentPadding = PaddingValues(0.dp),
- showLabel = false
- )
- }
- }
- }
-}
-
@Composable
internal fun GuideOptionsOverlay(
uiState: EpgUiState,
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 8d36c47a..106990a4 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
@@ -37,7 +37,8 @@ import com.streamvault.app.ui.screens.epg.EpgViewModel
import com.streamvault.app.ui.screens.epg.GuideCategoryPickerDialog
import com.streamvault.app.ui.screens.epg.GuideMessageState
import com.streamvault.feature.live.presentation.epg.LiveGuideNowProvider
-import com.streamvault.app.ui.screens.epg.GuideSearchOverlay
+import com.streamvault.feature.live.presentation.epg.LiveGuideSearchOverlay
+import com.streamvault.feature.live.presentation.epg.LiveGuideSearchOverlayLabels
import com.streamvault.app.ui.screens.epg.GuideToolbarButton
import com.streamvault.feature.live.presentation.epg.currentLiveGuideNow
import com.streamvault.app.ui.screens.epg.isGuideCategoryLocked
@@ -268,8 +269,15 @@ fun PlayerTransparentGuideOverlay(
}
if (showSearchOverlay) {
- GuideSearchOverlay(
+ LiveGuideSearchOverlay(
query = uiState.programSearchQuery,
+ labels = LiveGuideSearchOverlayLabels(
+ title = stringResource(R.string.epg_search_label),
+ apply = stringResource(R.string.epg_search_apply),
+ clearAndClose = stringResource(R.string.epg_clear_search_close),
+ searchPlaceholder = stringResource(R.string.epg_search_placeholder),
+ clear = stringResource(R.string.epg_clear_search)
+ ),
onQueryChange = onSearchQueryChange,
onClear = onClearSearch,
onDismiss = { showSearchOverlay = false }
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
index 2fcd1810..28f42bcc 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
@@ -135,7 +135,8 @@ Home channel row surface, Home channel-results header, Home category sidebar
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, and M3U series-assignment dialogs are now feature-owned
+organizer dialog, M3U series-assignment dialogs, and the EPG search overlay are
+now feature-owned
while the Home and EPG
screen/dialog composition remains in `:app` for the remaining app-specific
dialogs.
@@ -145,6 +146,7 @@ presentation primitives, `HomeUiState`, `HomePreviewUiState`, Guide
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 are independent of app code;
+series-assignment dialogs and the EPG search overlay 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 5323a697..f8fa6e47 100644
--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
@@ -25,7 +25,8 @@ Home channel row surface, Home channel-results header, Home category sidebar
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, and M3U series-assignment dialogs are now feature-owned
+organizer dialog, M3U series-assignment dialogs, and the EPG search overlay 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.
@@ -691,6 +692,8 @@ The M3U category organizer likewise receives explicit labels and reports only
the selected classification target to the app.
The single-item and category-review series dialogs own draft normalization and
assignment construction while the app retains repository mutations.
+The EPG search overlay owns modal/search presentation and focus behavior while
+Home/Guide callers supply localized labels and query 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/LiveGuideSearchOverlay.kt b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideSearchOverlay.kt
new file mode 100644
index 00000000..79adb42a
--- /dev/null
+++ b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideSearchOverlay.kt
@@ -0,0 +1,152 @@
+package com.streamvault.feature.live.presentation.epg
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.focusGroup
+import androidx.compose.foundation.interaction.MutableInteractionSource
+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.PaddingValues
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+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.graphics.Color
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.window.Dialog
+import androidx.compose.ui.window.DialogProperties
+import androidx.tv.material3.MaterialTheme
+import androidx.tv.material3.Surface
+import androidx.tv.material3.SurfaceDefaults
+import androidx.tv.material3.Text
+
+data class LiveGuideSearchOverlayLabels(
+ val title: String,
+ val apply: String,
+ val clearAndClose: String,
+ val searchPlaceholder: String,
+ val clear: String
+)
+
+@Composable
+fun LiveGuideSearchOverlay(
+ query: String,
+ labels: LiveGuideSearchOverlayLabels,
+ onQueryChange: (String) -> Unit,
+ onClear: () -> Unit,
+ onDismiss: () -> Unit
+) {
+ val searchFocusRequester = remember { FocusRequester() }
+ val applySearchAndClose = remember(onQueryChange, onDismiss) {
+ { submittedQuery: String ->
+ onQueryChange(submittedQuery)
+ onDismiss()
+ }
+ }
+ val clearAndClose = remember(onClear, onDismiss) {
+ {
+ onClear()
+ onDismiss()
+ }
+ }
+
+ LaunchedEffect(Unit) {
+ searchFocusRequester.requestFocus()
+ }
+
+ LiveGuideModalSearchDialog(
+ onDismiss = onDismiss,
+ contentAlignment = Alignment.TopCenter
+ ) {
+ Surface(
+ modifier = Modifier
+ .fillMaxWidth(0.72f)
+ .padding(top = 32.dp)
+ .focusGroup(),
+ colors = SurfaceDefaults.colors(containerColor = com.streamvault.core.ui.theme.SurfaceElevated),
+ shape = RoundedCornerShape(18.dp)
+ ) {
+ Column(
+ modifier = Modifier.padding(horizontal = 18.dp, vertical = 16.dp),
+ verticalArrangement = Arrangement.spacedBy(12.dp)
+ ) {
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Text(
+ text = labels.title,
+ style = MaterialTheme.typography.titleLarge,
+ color = com.streamvault.core.ui.theme.OnSurface
+ )
+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ LiveGuideShortcutChip(
+ label = labels.apply,
+ onClick = { applySearchAndClose(query.trim()) }
+ )
+ LiveGuideShortcutChip(
+ label = labels.clearAndClose,
+ onClick = clearAndClose
+ )
+ }
+ }
+ LiveGuideProgramSearchRow(
+ query = query,
+ onQueryChange = onQueryChange,
+ onClear = onClear,
+ searchLabel = labels.title,
+ searchPlaceholder = labels.searchPlaceholder,
+ clearLabel = labels.clear,
+ onSearch = applySearchAndClose,
+ focusRequester = searchFocusRequester,
+ autoRequestFocus = true,
+ contentPadding = PaddingValues(0.dp),
+ showLabel = false
+ )
+ }
+ }
+ }
+}
+
+@Composable
+private fun LiveGuideModalSearchDialog(
+ onDismiss: () -> Unit,
+ contentAlignment: Alignment = Alignment.Center,
+ content: @Composable BoxScope.() -> Unit
+) {
+ Dialog(
+ onDismissRequest = onDismiss,
+ properties = DialogProperties(
+ usePlatformDefaultWidth = false,
+ dismissOnBackPress = true,
+ dismissOnClickOutside = false
+ )
+ ) {
+ Box(
+ modifier = Modifier.fillMaxSize(),
+ contentAlignment = contentAlignment
+ ) {
+ Box(
+ modifier = Modifier
+ .matchParentSize()
+ .background(Color.Black.copy(alpha = 0.68f))
+ .clickable(
+ onClick = onDismiss,
+ indication = null,
+ interactionSource = remember { MutableInteractionSource() }
+ )
+ )
+ content()
+ }
+ }
+}