StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
refactor(live): extract channel content states
David Nashash60df822019a1
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.ktindex 257192e4..65c732b2 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.homeimport androidx.compose.material3.ExperimentalMaterial3Api-import androidx.compose.foundation.Canvasimport androidx.compose.foundation.layout.*import androidx.compose.foundation.layout.PaddingValuesimport androidx.compose.foundation.lazy.LazyColumn@@ -25,17 +24,12 @@ import androidx.compose.ui.platform.LocalFocusManagerimport androidx.compose.foundation.focusGroupimport androidx.compose.ui.input.key.*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.Colorimport androidx.compose.ui.unit.dpimport androidx.hilt.lifecycle.viewmodel.compose.hiltViewModelimport androidx.tv.material3.*import androidx.compose.material3.SnackbarHostimport androidx.compose.material3.SnackbarHostStateimport androidx.compose.material3.TextButton-import androidx.compose.material3.CircularProgressIndicator-import androidx.compose.material3.LinearProgressIndicatorimport com.streamvault.core.ui.device.rememberIsTelevisionDeviceimport androidx.compose.animation.Crossfadeimport androidx.compose.animation.core.tween@@ -48,8 +42,8 @@ import com.streamvault.feature.live.home.HomeLoadingPaneimport com.streamvault.feature.live.home.HomePreviewHostimport com.streamvault.feature.live.home.LiveChannelResultsHeaderimport com.streamvault.feature.live.home.LiveCategorySidebarHeader+import com.streamvault.feature.live.home.LiveChannelContentHostimport com.streamvault.feature.live.presentation.components.LiveChannelRowSurface-import com.streamvault.core.ui.components.shell.StatusPillimport com.streamvault.core.ui.components.TvEmptyStateimport com.streamvault.app.ui.components.dialogs.CategoryOptionsDialogimport com.streamvault.app.ui.components.dialogs.HiddenCategoriesDialog@@ -82,11 +76,6 @@ import com.streamvault.app.navigation.Routesimport com.streamvault.domain.model.VirtualCategoryIdsimport com.streamvault.domain.playback.archivePlaybackCapabilityimport com.streamvault.domain.repository.ChannelRepository-import androidx.compose.ui.viewinterop.AndroidView-import com.streamvault.player.PlayerSurfaceResizeMode-import java.text.SimpleDateFormat-import java.util.Date-import java.util.Localeimport com.streamvault.app.ui.remote.LiveBrowseRemoteShortcutHandlerimport com.streamvault.app.ui.remote.dispatchLiveBrowseRemoteShortcutimport com.streamvault.app.ui.remote.remoteColorButtonForKeyCode@@ -848,92 +837,24 @@ fun HomeScreen(animationSpec = tween(durationMillis = 200),label = "category_content_transition") { _ ->- if (uiState.isLoading) {- Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {- Column(- horizontalAlignment = Alignment.CenterHorizontally,- verticalArrangement = Arrangement.spacedBy(16.dp)- ) {- CircularProgressIndicator(color = Color.White)- Text(- text = stringResource(R.string.home_loading_channels),- color = Color.White.copy(alpha = 0.7f),- style = MaterialTheme.typography.bodyMedium- )- }- }- } else if (uiState.errorMessage != null) {- val errorMsg = uiState.errorMessage- Box(- modifier = Modifier.fillMaxSize(),- contentAlignment = Alignment.Center- ) {- Column(- horizontalAlignment = Alignment.CenterHorizontally,- verticalArrangement = Arrangement.spacedBy(6.dp)- ) {- Text(- text = errorMsg ?: "",- style = MaterialTheme.typography.titleMedium,- color = OnBackground- )- }- }- } else if (!uiState.hasChannels) {- Box(- modifier = Modifier.fillMaxSize(),- contentAlignment = Alignment.Center- ) {- Column(- horizontalAlignment = Alignment.CenterHorizontally,- verticalArrangement = Arrangement.spacedBy(6.dp)- ) {- if (hasBlockedCategorySearch) {- Icon(- imageVector = Icons.Filled.Lock,- contentDescription = null,- tint = OnBackground,- modifier = Modifier.size(34.dp)- )- Text(- text = stringResource(R.string.home_locked_short),- style = MaterialTheme.typography.titleLarge,- color = OnBackground- )- Text(- text = stringResource(R.string.home_no_channels_found_subtitle),- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- } else {- Text(- text = stringResource(R.string.home_no_channels_found),- style = MaterialTheme.typography.titleLarge,- color = OnBackground- )- Text(- text = stringResource(R.string.home_no_channels_found_subtitle),- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- val selectedCategory = uiState.selectedCategory- if (selectedCategory?.isVirtual == true && selectedCategory.id == VirtualCategoryIds.FAVORITES) {- Text(- text = stringResource(R.string.home_add_favorites_hint),- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- } else if (selectedCategory?.isVirtual == true && selectedCategory.id == VirtualCategoryIds.RECENT) {- Text(- text = stringResource(R.string.home_recent_channels_hint),- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- }- }- }+ val selectedCategory = uiState.selectedCategory+ LiveChannelContentHost(+ isLoading = uiState.isLoading,+ errorMessage = uiState.errorMessage,+ hasChannels = uiState.hasChannels,+ isBlockedCategorySearch = hasBlockedCategorySearch,+ loadingLabel = stringResource(R.string.home_loading_channels),+ lockedLabel = stringResource(R.string.home_locked_short),+ noChannelsLabel = stringResource(R.string.home_no_channels_found),+ noChannelsSubtitle = stringResource(R.string.home_no_channels_found_subtitle),+ additionalEmptyHint = when {+ selectedCategory?.isVirtual == true && selectedCategory.id == VirtualCategoryIds.FAVORITES ->+ stringResource(R.string.home_add_favorites_hint)+ selectedCategory?.isVirtual == true && selectedCategory.id == VirtualCategoryIds.RECENT ->+ stringResource(R.string.home_recent_channels_hint)+ else -> null}- } else {+ ) {var ignoreNextClick by remember { mutableStateOf(false) }val channelListState = rememberLazyListState()diff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.mdindex ed9a6c0d..66620dba 100644--- a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md+++ b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md@@ -131,8 +131,8 @@ the live boundary incrementally: `HomeViewModel`, the sidebar/preview surface,the loading/preview host supporting composables, the live source switcher, Homequick-filter panel/chip row, the reusable EPG guide shortcut chip, the sharedEPG guide-now ticker/provider, EPG search field/row, Home reorder top bar, and-Home channel row surface, Home channel-results header, and the Home category-sidebar header are now feature-owned while the Home and EPG+Home channel row surface, Home channel-results header, Home category sidebar+header, and channel-content state host are now feature-owned while the Home and EPGscreen/dialog composition remains in `:app`.The source switcher receives localized labels from the app at the currentcomposition boundary. Live-owneddiff --git a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md b/docs/superpowers/plans/2026-08-28-live-feature-extraction.mdindex aefa65eb..5b92cb38 100644--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md@@ -21,8 +21,8 @@ Status update (2026-08-29): `HomeViewModel`, the sidebar/preview surface, theloading/preview host supporting composables, the live source switcher, Homequick-filter panel/chip row, the reusable EPG guide shortcut chip, the sharedEPG guide-now ticker/provider, EPG search field/row, Home reorder top bar,-Home channel row surface, Home channel-results header, and the Home category-sidebar header are now feature-owned+Home channel row surface, Home channel-results header, Home category sidebar+header, and channel-content state host are now feature-ownedand their feature checks are green. Home screen/dialog composition, theremaining live cards/rows, complete locale resource migration, and acceptancegates remain open.@@ -665,6 +665,9 @@ feature-owned `LiveSourceSwitcher`, `LiveQuickFiltersPanel` (including itsformatting/accessibility text through explicit presentation parameters. Homealso calls `LiveCategorySidebarHeader`, which owns source-switcher/search/quick-filter layout while receiving app callbacks and localized labels. The+channel content state now calls `LiveChannelContentHost` for loading, error,+locked-empty, and no-channel presentation while keeping the channel-list slot+in the app. Thequick-filter key/selection rules are covered by `LiveQuickFiltersTest`. Theremaining app-owned live cards and shell/dialog composition still requirecompatibility seams before the full Home move.diff --git a/feature/live/src/main/java/com/streamvault/feature/live/home/LiveChannelContentHost.kt b/feature/live/src/main/java/com/streamvault/feature/live/home/LiveChannelContentHost.ktnew file mode 100644index 00000000..850d0427--- /dev/null+++ b/feature/live/src/main/java/com/streamvault/feature/live/home/LiveChannelContentHost.kt@@ -0,0 +1,107 @@+package com.streamvault.feature.live.home++import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.size+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.Lock+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.unit.dp+import androidx.tv.material3.Icon+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Text+import com.streamvault.core.ui.theme.OnBackground+import com.streamvault.core.ui.theme.OnSurfaceDim++@Composable+fun LiveChannelContentHost(+ isLoading: Boolean,+ errorMessage: String?,+ hasChannels: Boolean,+ isBlockedCategorySearch: Boolean,+ loadingLabel: String,+ lockedLabel: String,+ noChannelsLabel: String,+ noChannelsSubtitle: String,+ additionalEmptyHint: String? = null,+ modifier: Modifier = Modifier,+ channelContent: @Composable () -> Unit+) {+ Box(modifier = modifier.fillMaxSize()) {+ when {+ isLoading -> {+ Column(+ modifier = Modifier.align(Alignment.Center),+ horizontalAlignment = Alignment.CenterHorizontally,+ verticalArrangement = Arrangement.spacedBy(16.dp)+ ) {+ CircularProgressIndicator(color = Color.White)+ Text(+ text = loadingLabel,+ color = Color.White.copy(alpha = 0.7f),+ style = MaterialTheme.typography.bodyMedium+ )+ }+ }++ errorMessage != null -> {+ Text(+ text = errorMessage,+ modifier = Modifier.align(Alignment.Center),+ style = MaterialTheme.typography.titleMedium,+ color = OnBackground+ )+ }++ !hasChannels -> {+ Column(+ modifier = Modifier.align(Alignment.Center),+ horizontalAlignment = Alignment.CenterHorizontally,+ verticalArrangement = Arrangement.spacedBy(6.dp)+ ) {+ if (isBlockedCategorySearch) {+ Icon(+ imageVector = Icons.Filled.Lock,+ contentDescription = null,+ tint = OnBackground,+ modifier = Modifier.size(34.dp)+ )+ Text(+ text = lockedLabel,+ style = MaterialTheme.typography.titleLarge,+ color = OnBackground+ )+ } else {+ Text(+ text = noChannelsLabel,+ style = MaterialTheme.typography.titleLarge,+ color = OnBackground+ )+ }+ Text(+ text = noChannelsSubtitle,+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ if (!isBlockedCategorySearch) {+ additionalEmptyHint?.let { hint ->+ Text(+ text = hint,+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }+ }+ }+ }++ else -> channelContent()+ }+ }+}