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 Home channel header

David Nashashd67e6e74d26b
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt
index ad67ec9b..7c9bb987 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt
@@ -1,7 +1,6 @@
package com.streamvault.app.ui.screens.home
import androidx.compose.material3.ExperimentalMaterial3Api
-import androidx.compose.foundation.basicMarquee
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.PaddingValues
@@ -31,7 +30,6 @@ import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.material.icons.filled.Lock
import androidx.compose.material.icons.Icons
import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import androidx.tv.material3.*
@@ -49,10 +47,9 @@ import com.streamvault.feature.live.presentation.components.LiveChannelProgressT
import com.streamvault.feature.live.presentation.components.LiveSourceSwitcher
import com.streamvault.feature.live.home.HomeViewModel
import com.streamvault.feature.live.home.CategoryItem
-import com.streamvault.feature.live.home.CompactSplitLauncherButton
import com.streamvault.feature.live.home.HomeLoadingPane
import com.streamvault.feature.live.home.HomePreviewHost
-import com.streamvault.core.ui.components.shell.ContentMetadataStrip
+import com.streamvault.feature.live.home.LiveChannelResultsHeader
import com.streamvault.feature.live.presentation.components.LiveChannelRowSurface
import com.streamvault.core.ui.components.shell.StatusPill
import com.streamvault.core.ui.components.TvEmptyState
@@ -856,82 +853,40 @@ fun HomeScreen(
.weight(if (isProMode) 1.08f else 1f)
.fillMaxHeight()
) {
- Column(
- modifier = Modifier
- .fillMaxWidth()
- .padding(start = 8.dp, top = 2.dp, bottom = if (isDenseMode) 4.dp else 6.dp, end = 8.dp),
- verticalArrangement = Arrangement.spacedBy(if (isDenseMode) 2.dp else 4.dp)
- ) {
- Row(
- modifier = Modifier.fillMaxWidth(),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically
- ) {
- Text(
- text = displayedCategory?.name ?: if (hasBlockedCategorySearch) {
- stringResource(R.string.home_locked_short)
- } else {
- stringResource(R.string.home_all_channels)
- },
- style = if (isDenseMode) MaterialTheme.typography.titleMedium else MaterialTheme.typography.titleLarge,
- color = OnBackground,
- maxLines = 1,
- overflow = TextOverflow.Clip,
- modifier = Modifier
- .weight(1f)
- .padding(end = 8.dp)
- .basicMarquee(
- iterations = Int.MAX_VALUE,
- initialDelayMillis = 900,
- repeatDelayMillis = 1200,
- velocity = 24.dp
+ LiveChannelResultsHeader(
+ heading = displayedCategory?.name ?: if (hasBlockedCategorySearch) {
+ stringResource(R.string.home_locked_short)
+ } else {
+ stringResource(R.string.home_all_channels)
+ },
+ resultCountLabel = stringResource(
+ R.string.live_channel_results,
+ uiState.filteredChannels.size
+ ),
+ metadataValues = buildList {
+ add(stringResource(R.string.live_channel_results, uiState.filteredChannels.size))
+ uiState.lastVisitedCategory?.name?.let {
+ add(
+ stringResource(
+ R.string.label_colon_value_format,
+ stringResource(R.string.live_shell_last_group),
+ it
)
- )
- if (hasSplitChannels) {
- CompactSplitLauncherButton(
- slotCount = uiState.multiviewChannelCount,
- slotLimit = uiState.multiviewSlotCapacity,
- onClick = { showSplitManagerDialog = true },
- modifier = Modifier.padding(start = 12.dp)
)
}
- }
- if (isDenseMode) {
- Row(
- horizontalArrangement = Arrangement.spacedBy(10.dp),
- verticalAlignment = Alignment.CenterVertically
- ) {
- Text(
- text = stringResource(R.string.live_channel_results, uiState.filteredChannels.size),
- style = MaterialTheme.typography.labelMedium,
- color = OnSurfaceDim,
- maxLines = 1
- )
- }
- } else {
- ContentMetadataStrip(
- values = buildList {
- add(stringResource(R.string.live_channel_results, uiState.filteredChannels.size))
- uiState.lastVisitedCategory?.name?.let {
- add(stringResource(R.string.label_colon_value_format, stringResource(R.string.live_shell_last_group), it))
- }
- }
- )
- }
- SearchInput(
- value = uiState.channelSearchQuery,
- onValueChange = {
- if (!isReorderMode) {
- viewModel.updateChannelSearchQuery(it)
- }
- },
- placeholder = stringResource(R.string.home_search_channels),
- onSearch = {},
- focusRequester = channelSearchFocusRequester,
- modifier = Modifier.width(channelSearchWidth),
- enabled = !isReorderMode
- )
- }
+ },
+ isDenseMode = isDenseMode,
+ hasSplitChannels = hasSplitChannels,
+ slotCount = uiState.multiviewChannelCount,
+ slotLimit = uiState.multiviewSlotCapacity,
+ onOpenSplit = { showSplitManagerDialog = true },
+ channelSearchQuery = uiState.channelSearchQuery,
+ onChannelSearchQueryChanged = viewModel::updateChannelSearchQuery,
+ searchPlaceholder = stringResource(R.string.home_search_channels),
+ channelSearchFocusRequester = channelSearchFocusRequester,
+ channelSearchWidth = channelSearchWidth,
+ isReorderMode = isReorderMode
+ )
Crossfade(
targetState = uiState.selectedCategory?.id,
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
index 7144609d..4818a29b 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
@@ -131,7 +131,8 @@ 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, the reusable EPG guide shortcut chip, the shared
EPG guide-now ticker/provider, EPG search field/row, Home reorder top bar, and
-Home channel row surface are now feature-owned while the Home and EPG
+Home channel row surface, and Home channel-results header 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
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 522b118a..16f6e188 100644
--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
@@ -20,8 +20,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, the reusable EPG guide shortcut chip, the shared
-EPG guide-now ticker/provider, EPG search field/row, Home reorder top bar, and
-Home channel row surface are now feature-owned
+EPG guide-now ticker/provider, EPG search field/row, Home reorder top bar,
+Home channel row surface, and Home channel-results header 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.
@@ -660,11 +660,11 @@ feature-owned `LiveSourceSwitcher`, `LiveQuickFiltersPanel` (including its
`LiveSelectionChipRow`), `LiveGuideShortcutChip`, `LiveGuideSearchField` /
`LiveGuideProgramSearchRow`, `LiveReorderTopBar`, and
`LiveGuideNowProvider`/`currentLiveGuideNow`, 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
-shell/dialog composition still require compatibility seams before the full
-Home move.
+`LiveChannelResultsHeader`, 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 shell/dialog composition still require
+compatibility seams before the full Home move.
Preserve planner callback order:
diff --git a/feature/live/src/main/java/com/streamvault/feature/live/home/LiveChannelResultsHeader.kt b/feature/live/src/main/java/com/streamvault/feature/live/home/LiveChannelResultsHeader.kt
new file mode 100644
index 00000000..2f76b5b3
--- /dev/null
+++ b/feature/live/src/main/java/com/streamvault/feature/live/home/LiveChannelResultsHeader.kt
@@ -0,0 +1,98 @@
+package com.streamvault.feature.live.home
+
+import androidx.compose.foundation.basicMarquee
+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.width
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.focus.FocusRequester
+import androidx.compose.ui.text.style.TextOverflow
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import androidx.tv.material3.MaterialTheme
+import androidx.tv.material3.Text
+import com.streamvault.core.ui.components.SearchInput
+import com.streamvault.core.ui.components.shell.ContentMetadataStrip
+import com.streamvault.core.ui.theme.OnBackground
+import com.streamvault.core.ui.theme.OnSurfaceDim
+
+@Composable
+fun LiveChannelResultsHeader(
+ heading: String,
+ resultCountLabel: String,
+ metadataValues: List<String>,
+ isDenseMode: Boolean,
+ hasSplitChannels: Boolean,
+ slotCount: Int,
+ slotLimit: Int,
+ onOpenSplit: () -> Unit,
+ channelSearchQuery: String,
+ onChannelSearchQueryChanged: (String) -> Unit,
+ searchPlaceholder: String,
+ channelSearchFocusRequester: FocusRequester,
+ channelSearchWidth: Dp,
+ isReorderMode: Boolean,
+ modifier: Modifier = Modifier
+) {
+ Column(
+ modifier = modifier
+ .fillMaxWidth()
+ .padding(start = 8.dp, top = 2.dp, bottom = if (isDenseMode) 4.dp else 6.dp, end = 8.dp),
+ verticalArrangement = Arrangement.spacedBy(if (isDenseMode) 2.dp else 4.dp)
+ ) {
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Text(
+ text = heading,
+ style = if (isDenseMode) MaterialTheme.typography.titleMedium else MaterialTheme.typography.titleLarge,
+ color = OnBackground,
+ maxLines = 1,
+ overflow = TextOverflow.Clip,
+ modifier = Modifier
+ .weight(1f)
+ .padding(end = 8.dp)
+ .basicMarquee(
+ iterations = Int.MAX_VALUE,
+ initialDelayMillis = 900,
+ repeatDelayMillis = 1200,
+ velocity = 24.dp
+ )
+ )
+ if (hasSplitChannels) {
+ CompactSplitLauncherButton(
+ slotCount = slotCount,
+ slotLimit = slotLimit,
+ onClick = onOpenSplit,
+ modifier = Modifier.padding(start = 12.dp)
+ )
+ }
+ }
+ if (isDenseMode) {
+ Text(
+ text = resultCountLabel,
+ style = MaterialTheme.typography.labelMedium,
+ color = OnSurfaceDim,
+ maxLines = 1
+ )
+ } else {
+ ContentMetadataStrip(values = metadataValues)
+ }
+ SearchInput(
+ value = channelSearchQuery,
+ onValueChange = { if (!isReorderMode) onChannelSearchQueryChanged(it) },
+ placeholder = searchPlaceholder,
+ onSearch = {},
+ focusRequester = channelSearchFocusRequester,
+ modifier = Modifier.width(channelSearchWidth),
+ enabled = !isReorderMode
+ )
+ }
+}