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 epg preview pane
David Nashashf56d47da33e4
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.ktindex af58fad2..24f0dc6b 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@@ -3,11 +3,8 @@ package com.streamvault.app.ui.screens.epgimport androidx.compose.foundation.BorderStrokeimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.Row-import androidx.compose.foundation.layout.aspectRatio-import androidx.compose.foundation.layout.fillMaxHeightimport androidx.compose.foundation.layout.fillMaxSizeimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.height@@ -16,7 +13,6 @@ import androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.widthimport androidx.compose.foundation.layout.widthInimport androidx.compose.foundation.shape.RoundedCornerShape-import androidx.compose.material3.CircularProgressIndicatorimport androidx.compose.material3.LinearProgressIndicatorimport androidx.compose.runtime.Composableimport androidx.compose.runtime.derivedStateOf@@ -31,10 +27,8 @@ import androidx.compose.ui.focus.onFocusChangedimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.style.TextOverflow-import androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.unit.dpimport androidx.compose.ui.unit.sp-import androidx.lifecycle.compose.collectAsStateWithLifecycleimport androidx.tv.material3.Borderimport androidx.tv.material3.ClickableSurfaceDefaultsimport androidx.tv.material3.MaterialTheme@@ -45,7 +39,6 @@ import com.streamvault.app.Rimport com.streamvault.feature.live.presentation.epg.GuideDensityimport com.streamvault.feature.live.presentation.epg.currentLiveGuideNowimport com.streamvault.core.ui.image.ChannelLogoBadge-import com.streamvault.player.ui.PlayerRenderViewimport com.streamvault.domain.playback.isArchivePlayableimport com.streamvault.core.ui.interaction.TvClickableSurfaceimport com.streamvault.feature.live.presentation.model.guideLookupKey@@ -59,9 +52,6 @@ import com.streamvault.core.ui.theme.SurfaceElevatedimport com.streamvault.core.ui.theme.SurfaceHighlightimport com.streamvault.domain.model.Channelimport com.streamvault.domain.model.Program-import com.streamvault.player.PlayerEngine-import com.streamvault.player.PlayerRenderSurfaceType-import com.streamvault.player.PlayerSurfaceResizeModeimport java.util.Dateinternal data class GuideHeroSelection(@@ -96,7 +86,6 @@ internal fun resolveGuideHeroSelection(isFallbackToChannel = resolvedProgram == null)}-@Composableinternal fun GuideHeroSection(uiState: EpgUiState,@@ -310,150 +299,6 @@ internal fun GuideHeroBadge(}}-@Composable-internal fun GuidePreviewPane(- previewPlayerEngine: PlayerEngine?,- isPreviewLoading: Boolean,- focusedChannel: Channel?,- focusedProgram: Program?,- modifier: Modifier = Modifier-) {- val renderSurfaceType by (previewPlayerEngine?.renderSurfaceType)?.collectAsStateWithLifecycle(- initialValue = PlayerRenderSurfaceType.SURFACE_VIEW- ) ?: remember { mutableStateOf(PlayerRenderSurfaceType.SURFACE_VIEW) }- val now = currentLiveGuideNow()- val appTimeFormat = LocalLiveTimeFormat.current- val timeFormat = remember(appTimeFormat) { appTimeFormat.createLiveTimeFormat() }-- Surface(- modifier = modifier.height(150.dp),- colors = SurfaceDefaults.colors(containerColor = SurfaceElevated),- shape = RoundedCornerShape(20.dp)- ) {- Row(- modifier = Modifier- .fillMaxSize()- .padding(10.dp),- horizontalArrangement = Arrangement.spacedBy(14.dp),- verticalAlignment = Alignment.CenterVertically- ) {- // Video preview area (16:9 at 90dp height = 160dp wide)- Box(- modifier = Modifier- .fillMaxHeight()- .aspectRatio(16f / 9f)- .background(Color.Black, RoundedCornerShape(12.dp))- .clip(RoundedCornerShape(12.dp)),- contentAlignment = Alignment.Center- ) {- if (previewPlayerEngine != null) {- PlayerRenderView(- playerEngine = previewPlayerEngine,- resizeMode = PlayerSurfaceResizeMode.FIT,- surfaceType = renderSurfaceType,- modifier = Modifier.fillMaxSize()- )- if (isPreviewLoading) {- CircularProgressIndicator(- color = Primary,- strokeWidth = 2.dp,- modifier = Modifier.size(22.dp)- )- }- } else {- Column(- horizontalAlignment = Alignment.CenterHorizontally,- verticalArrangement = Arrangement.spacedBy(4.dp),- modifier = Modifier.padding(horizontal = 12.dp)- ) {- Text(- text = stringResource(R.string.live_preview_placeholder_title),- style = MaterialTheme.typography.labelMedium,- color = OnSurfaceDim,- textAlign = TextAlign.Center- )- }- }- }-- // Program info- val channel = focusedChannel- val program = focusedProgram- if (channel != null) {- Column(- modifier = Modifier.weight(1f),- verticalArrangement = Arrangement.spacedBy(2.dp)- ) {- Row(- horizontalArrangement = Arrangement.spacedBy(10.dp),- verticalAlignment = Alignment.CenterVertically- ) {- ChannelLogoBadge(- channelName = channel.name,- logoUrl = channel.logoUrl,- modifier = Modifier.size(32.dp),- shape = RoundedCornerShape(8.dp)- )- Text(- text = if (channel.number > 0) "${channel.number}. ${channel.name}" else channel.name,- style = MaterialTheme.typography.titleSmall,- color = OnSurface,- maxLines = 1,- overflow = TextOverflow.Ellipsis- )- }- if (program != null) {- Text(- text = program.title,- style = MaterialTheme.typography.bodyMedium,- color = OnSurface,- maxLines = 1,- overflow = TextOverflow.Ellipsis- )- Text(- text = "${timeFormat.format(Date(program.startTime))} ג€“ ${timeFormat.format(Date(program.endTime))}",- style = MaterialTheme.typography.labelSmall,- color = OnSurfaceDim- )- if (now in program.startTime until program.endTime) {- LinearProgressIndicator(- progress = { ((now - program.startTime).toFloat() / (program.endTime - program.startTime).toFloat()).coerceIn(0f, 1f) },- modifier = Modifier- .fillMaxWidth(0.6f)- .height(3.dp),- color = Primary,- trackColor = SurfaceHighlight- )- }- if (program.description.isNotBlank()) {- Text(- text = program.description,- style = MaterialTheme.typography.labelSmall,- color = OnSurfaceDim,- maxLines = 2,- overflow = TextOverflow.Ellipsis- )- }- } else {- Text(- text = stringResource(R.string.epg_no_schedule),- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- }- }- } else {- Text(- text = stringResource(R.string.epg_title),- style = MaterialTheme.typography.titleSmall,- color = OnSurfaceDim,- modifier = Modifier.weight(1f)- )- }- }- }-}-@Composableinternal fun GuideToolbarRow(selectedCategoryName: String,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.ktindex 81fd2305..9820b26c 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@@ -20,6 +20,8 @@ import com.streamvault.feature.live.presentation.epg.LiveGuideFavoritesLabelsimport com.streamvault.feature.live.presentation.epg.LiveGuideModeLabelsimport com.streamvault.feature.live.presentation.epg.LiveGuideTimeControlLabelsimport com.streamvault.feature.live.presentation.epg.LiveGuideViewOptionsLabels+import com.streamvault.feature.live.presentation.epg.LiveGuidePreviewLabels+import com.streamvault.feature.live.presentation.epg.LiveGuidePreviewPaneimport androidx.compose.foundation.BorderStrokeimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickable@@ -433,11 +435,16 @@ fun FullEpgScreen(else -> {LiveGuideNowProvider {- GuidePreviewPane(+ LiveGuidePreviewPane(previewPlayerEngine = uiState.previewPlayerEngine,isPreviewLoading = uiState.isPreviewLoading,focusedChannel = focusedChannel,focusedProgram = focusedProgram,+ labels = LiveGuidePreviewLabels(+ title = stringResource(R.string.epg_title),+ placeholderTitle = stringResource(R.string.live_preview_placeholder_title),+ noSchedule = stringResource(R.string.epg_no_schedule)+ ),modifier = Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 4.dp)diff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.mdindex abacb2f1..1a6a0bd2 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 hostand hidden category/channel dialogs, the category options dialog, thequick-filter add dialog, delete-group dialog, rename-group dialog, M3U categoryorganizer dialog, M3U series-assignment dialogs, EPG search overlay, guide-category picker, compact guide-program dialog, and the guide control rows are-now feature-owned+category picker, compact guide-program dialog, guide control rows, and EPG+preview pane are now feature-ownedwhile the Home and EPGscreen/dialog composition remains in `:app` for the remaining app-specificdialogs.@@ -148,6 +148,7 @@ mode/density/reminder presentation models, hidden collection dialogs, thecategory options dialog, the quick-filter add dialog, the delete-group dialog,and the rename-group dialog, M3U category organizer dialog, and M3Useries-assignment dialogs, the EPG search overlay, guide category picker, and-compact guide-program dialog and guide control rows are independent of app code;+compact guide-program dialog, guide control rows, and EPG preview pane are+independent of app code;screen/resource moves, golden/runtime/performance gates, and legacy app cleanupremain 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.mdindex db147bfa..2d1b5e5d 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 hostand hidden category/channel dialogs, the category options dialog, thequick-filter add dialog, delete-group dialog, rename-group dialog, M3U categoryorganizer dialog, M3U series-assignment dialogs, EPG search overlay, guide-category picker, compact guide-program dialog, and guide control rows are now-feature-owned+category picker, compact guide-program dialog, guide control rows, and EPG+preview pane 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.@@ -702,7 +702,9 @@ details state, focus, and action affordances while the app supplies labels andplayback/recording callbacks.The guide control rows (time paging, day selection, mode, density, view, andfavorites) are also feature-owned; the options shell continues to supply labels-and ViewModel callbacks from `:app`.+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.quick-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/presentation/epg/LiveGuidePreviewPane.kt b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuidePreviewPane.ktnew file mode 100644index 00000000..c2e7ddcd--- /dev/null+++ b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuidePreviewPane.kt@@ -0,0 +1,189 @@+package com.streamvault.feature.live.presentation.epg++import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.aspectRatio+import androidx.compose.foundation.layout.fillMaxHeight+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.LinearProgressIndicator+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.lifecycle.compose.collectAsStateWithLifecycle+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Text+import com.streamvault.core.ui.image.ChannelLogoBadge+import com.streamvault.core.ui.theme.OnSurface+import com.streamvault.core.ui.theme.OnSurfaceDim+import com.streamvault.core.ui.theme.Primary+import com.streamvault.core.ui.theme.SurfaceElevated+import com.streamvault.core.ui.theme.SurfaceHighlight+import com.streamvault.domain.model.Channel+import com.streamvault.domain.model.Program+import com.streamvault.feature.live.presentation.time.LocalLiveTimeFormat+import com.streamvault.feature.live.presentation.time.createLiveTimeFormat+import com.streamvault.player.PlayerEngine+import com.streamvault.player.PlayerRenderSurfaceType+import com.streamvault.player.PlayerSurfaceResizeMode+import com.streamvault.player.ui.PlayerRenderView+import java.util.Date++data class LiveGuidePreviewLabels(+ val title: String,+ val placeholderTitle: String,+ val noSchedule: String+)++@Composable+fun LiveGuidePreviewPane(+ previewPlayerEngine: PlayerEngine?,+ isPreviewLoading: Boolean,+ focusedChannel: Channel?,+ focusedProgram: Program?,+ labels: LiveGuidePreviewLabels,+ modifier: Modifier = Modifier+) {+ val renderSurfaceType by (previewPlayerEngine?.renderSurfaceType)?.collectAsStateWithLifecycle(+ initialValue = PlayerRenderSurfaceType.SURFACE_VIEW+ ) ?: remember { mutableStateOf(PlayerRenderSurfaceType.SURFACE_VIEW) }+ val now = currentLiveGuideNow()+ val appTimeFormat = LocalLiveTimeFormat.current+ val timeFormat = remember(appTimeFormat) { appTimeFormat.createLiveTimeFormat() }++ Surface(+ modifier = modifier.height(150.dp),+ colors = SurfaceDefaults.colors(containerColor = SurfaceElevated),+ shape = RoundedCornerShape(20.dp)+ ) {+ Row(+ modifier = Modifier.fillMaxSize().padding(10.dp),+ horizontalArrangement = Arrangement.spacedBy(14.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Box(+ modifier = Modifier+ .fillMaxHeight()+ .aspectRatio(16f / 9f)+ .background(Color.Black, RoundedCornerShape(12.dp))+ .clip(RoundedCornerShape(12.dp)),+ contentAlignment = Alignment.Center+ ) {+ if (previewPlayerEngine != null) {+ PlayerRenderView(+ playerEngine = previewPlayerEngine,+ resizeMode = PlayerSurfaceResizeMode.FIT,+ surfaceType = renderSurfaceType,+ modifier = Modifier.fillMaxSize()+ )+ if (isPreviewLoading) {+ CircularProgressIndicator(+ color = Primary,+ strokeWidth = 2.dp,+ modifier = Modifier.size(22.dp)+ )+ }+ } else {+ Column(+ horizontalAlignment = Alignment.CenterHorizontally,+ verticalArrangement = Arrangement.spacedBy(4.dp),+ modifier = Modifier.padding(horizontal = 12.dp)+ ) {+ Text(+ text = labels.placeholderTitle,+ style = MaterialTheme.typography.labelMedium,+ color = OnSurfaceDim,+ textAlign = TextAlign.Center+ )+ }+ }+ }++ val channel = focusedChannel+ val program = focusedProgram+ if (channel != null) {+ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(2.dp)+ ) {+ Row(+ horizontalArrangement = Arrangement.spacedBy(10.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ ChannelLogoBadge(+ channelName = channel.name,+ logoUrl = channel.logoUrl,+ modifier = Modifier.size(32.dp),+ shape = RoundedCornerShape(8.dp)+ )+ Text(+ text = if (channel.number > 0) "${channel.number}. ${channel.name}" else channel.name,+ style = MaterialTheme.typography.titleSmall,+ color = OnSurface,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ }+ if (program != null) {+ Text(+ text = program.title,+ style = MaterialTheme.typography.bodyMedium,+ color = OnSurface,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ Text(+ text = "${timeFormat.format(Date(program.startTime))} ׳’ג‚¬ג€ ${timeFormat.format(Date(program.endTime))}",+ style = MaterialTheme.typography.labelSmall,+ color = OnSurfaceDim+ )+ if (now in program.startTime until program.endTime) {+ LinearProgressIndicator(+ progress = { ((now - program.startTime).toFloat() / (program.endTime - program.startTime).toFloat()).coerceIn(0f, 1f) },+ modifier = Modifier.fillMaxWidth(0.6f).height(3.dp),+ color = Primary,+ trackColor = SurfaceHighlight+ )+ }+ if (program.description.isNotBlank()) {+ Text(+ text = program.description,+ style = MaterialTheme.typography.labelSmall,+ color = OnSurfaceDim,+ maxLines = 2,+ overflow = TextOverflow.Ellipsis+ )+ }+ } else {+ Text(text = labels.noSchedule, style = MaterialTheme.typography.bodySmall, color = OnSurfaceDim)+ }+ }+ } else {+ Text(+ text = labels.title,+ style = MaterialTheme.typography.titleSmall,+ color = OnSurfaceDim,+ modifier = Modifier.weight(1f)+ )+ }+ }+ }+}