StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
Add transparent live guide overlay
David Nashash6a40dfd4239f
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgGridComponents.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgGridComponents.ktindex fff33c86..e5576790 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgGridComponents.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgGridComponents.kt@@ -19,6 +19,7 @@ import androidx.compose.foundation.layout.widthimport androidx.compose.foundation.layout.widthInimport androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.itemsIndexed+import androidx.compose.foundation.lazy.rememberLazyListStateimport androidx.compose.foundation.rememberScrollStateimport androidx.compose.foundation.shape.CircleShapeimport androidx.compose.foundation.shape.RoundedCornerShape@@ -32,7 +33,9 @@ import androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clip+import androidx.compose.ui.focus.FocusRequesterimport androidx.compose.ui.focus.onFocusChanged+import androidx.compose.ui.focus.focusRequesterimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.style.TextOverflow@@ -65,6 +68,7 @@ import com.streamvault.domain.model.Channelimport com.streamvault.domain.model.Programimport java.time.Instantimport java.time.ZoneId+import kotlinx.coroutines.delayimport kotlin.math.max@Composable@@ -117,6 +121,8 @@ internal fun EpgGrid(guideWindowStart: Long,guideWindowEnd: Long,density: GuideDensity,+ transparentOverlay: Boolean = false,+ initialFocusedChannelId: Long? = null,onChannelClick: (Channel) -> Unit,onChannelLongClick: ((Channel, Program?) -> Unit)? = null,onProgramClick: (Channel, Program) -> Unit,@@ -132,6 +138,22 @@ internal fun EpgGrid(GuideDensity.CINEMATIC -> 52.dp}val horizontalScrollState = rememberScrollState()+ val verticalListState = rememberLazyListState()+ val resolvedInitialChannelId = initialFocusedChannelId ?: channels.firstOrNull()?.id+ val initialFocusRequester = remember(resolvedInitialChannelId) { FocusRequester() }+ val initialFocusIndex = remember(channels, resolvedInitialChannelId) {+ resolvedInitialChannelId+ ?.let { channelId -> channels.indexOfFirst { it.id == channelId } }+ ?.takeIf { it >= 0 }+ ?: 0+ }++ LaunchedEffect(channels.size, resolvedInitialChannelId) {+ if (channels.isEmpty()) return@LaunchedEffect+ verticalListState.scrollToItem((initialFocusIndex - 2).coerceAtLeast(0))+ delay(140)+ initialFocusRequester.requestFocus()+ }BoxWithConstraints(modifier = modifier@@ -162,6 +184,7 @@ internal fun EpgGrid()Spacer(modifier = Modifier.height(4.dp))LazyColumn(+ state = verticalListState,modifier = Modifier.fillMaxSize(),verticalArrangement = Arrangement.spacedBy(2.dp)) {@@ -187,9 +210,11 @@ internal fun EpgGrid(timelineViewportWidth = timelineViewportWidth,totalTimelineWidth = totalTimelineWidth,density = density,+ transparentOverlay = transparentOverlay,rowHeight = rowHeight,markerStepMs = markerStepMs,scrollState = horizontalScrollState,+ focusRequester = if (channel.id == resolvedInitialChannelId) initialFocusRequester else null,onChannelClick = { onChannelClick(channel) },onChannelLongClick = onChannelLongClick?.let { cb -> { prog -> cb(channel, prog) } },onChannelFocused = { onChannelFocused(channel, it, isFirstRow) },@@ -311,9 +336,11 @@ fun EpgRow(timelineViewportWidth: Dp,totalTimelineWidth: Dp,density: GuideDensity,+ transparentOverlay: Boolean,rowHeight: Dp,markerStepMs: Long,scrollState: androidx.compose.foundation.ScrollState,+ focusRequester: FocusRequester? = null,onChannelClick: () -> Unit,onChannelLongClick: ((Program?) -> Unit)? = null,onChannelFocused: (Program?) -> Unit,@@ -355,6 +382,13 @@ fun EpgRow(modifier = Modifier.width(channelRailWidth).fillMaxHeight()+ .then(+ if (focusRequester != null) {+ Modifier.focusRequester(focusRequester)+ } else {+ Modifier+ }+ ).onFocusChanged {if (it.isFocused && !isFocused) {onChannelFocused(currentProgram)@@ -362,8 +396,8 @@ fun EpgRow(isFocused = it.isFocused},colors = ClickableSurfaceDefaults.colors(- containerColor = SurfaceElevated,- focusedContainerColor = SurfaceHighlight+ containerColor = if (transparentOverlay) SurfaceElevated.copy(alpha = 0.62f) else SurfaceElevated,+ focusedContainerColor = if (transparentOverlay) SurfaceHighlight.copy(alpha = 0.88f) else SurfaceHighlight),shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),border = ClickableSurfaceDefaults.border(@@ -444,7 +478,10 @@ fun EpgRow(modifier = Modifier.width(timelineViewportWidth).fillMaxHeight()- .background(SurfaceElevated, RoundedCornerShape(8.dp))+ .background(+ if (transparentOverlay) SurfaceElevated.copy(alpha = 0.48f) else SurfaceElevated,+ RoundedCornerShape(8.dp)+ ).clip(RoundedCornerShape(8.dp))) {Row(@@ -486,6 +523,7 @@ fun EpgRow(ProgramItem(program = program,density = density,+ transparentOverlay = transparentOverlay,windowStart = windowStart,windowEnd = windowEnd,totalTimelineWidth = totalTimelineWidth,@@ -504,6 +542,7 @@ fun EpgRow(fun ProgramItem(program: Program,density: GuideDensity,+ transparentOverlay: Boolean,windowStart: Long,windowEnd: Long,totalTimelineWidth: Dp,@@ -586,8 +625,13 @@ fun ProgramItem(isFocused = it.isFocused},colors = ClickableSurfaceDefaults.colors(- containerColor = if (isCurrent) Primary.copy(alpha = 0.2f) else SurfaceElevated,- focusedContainerColor = SurfaceHighlight+ containerColor = when {+ isCurrent && transparentOverlay -> Primary.copy(alpha = 0.28f)+ isCurrent -> Primary.copy(alpha = 0.2f)+ transparentOverlay -> SurfaceElevated.copy(alpha = 0.54f)+ else -> SurfaceElevated+ },+ focusedContainerColor = if (transparentOverlay) SurfaceHighlight.copy(alpha = 0.88f) else SurfaceHighlight),shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),border = ClickableSurfaceDefaults.border(diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerGuideOverlaySupport.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerGuideOverlaySupport.ktnew file mode 100644index 00000000..e3a607c0--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerGuideOverlaySupport.kt@@ -0,0 +1,32 @@+package com.streamvault.app.ui.screens.player++import com.streamvault.domain.model.VirtualCategoryIds+import com.streamvault.domain.repository.ChannelRepository++internal data class PlayerGuideNavigationContext(+ val categoryId: Long?,+ val favoritesOnly: Boolean+)++internal fun resolvePlayerGuideNavigationContext(+ activeCategoryId: Long,+ currentChannelCategoryId: Long?+): PlayerGuideNavigationContext =+ when (activeCategoryId) {+ ChannelRepository.ALL_CHANNELS_ID -> PlayerGuideNavigationContext(+ categoryId = currentChannelCategoryId?.takeIf { it > 0L } ?: ChannelRepository.ALL_CHANNELS_ID,+ favoritesOnly = false+ )+ VirtualCategoryIds.FAVORITES -> PlayerGuideNavigationContext(+ categoryId = ChannelRepository.ALL_CHANNELS_ID,+ favoritesOnly = true+ )+ in 1L..Long.MAX_VALUE -> PlayerGuideNavigationContext(+ categoryId = activeCategoryId,+ favoritesOnly = false+ )+ else -> PlayerGuideNavigationContext(+ categoryId = currentChannelCategoryId?.takeIf { it > 0L } ?: ChannelRepository.ALL_CHANNELS_ID,+ favoritesOnly = false+ )+ }diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerOverlayActions.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerOverlayActions.ktindex b8ec95f9..8d20c55e 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerOverlayActions.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerOverlayActions.kt@@ -2,7 +2,10 @@ package com.streamvault.app.ui.screens.playerimport androidx.lifecycle.viewModelScopeimport com.streamvault.domain.model.Category+import com.streamvault.domain.model.Channelimport com.streamvault.domain.model.ContentType+import com.streamvault.domain.model.VirtualCategoryIds+import com.streamvault.domain.repository.ChannelRepositoryimport kotlinx.coroutines.delayimport kotlinx.coroutines.launch@@ -13,6 +16,7 @@ fun PlayerViewModel.openChannelListOverlay() {showChannelListOverlayFlow.value = trueshowCategoryListOverlayFlow.value = falseshowEpgOverlayFlow.value = false+ showFullGuideOverlayFlow.value = falseshowChannelInfoOverlayFlow.value = falseshowControlsFlow.value = falsescheduleLiveOverlayAutoHide()@@ -22,6 +26,7 @@ fun PlayerViewModel.openCategoryListOverlay() {if (currentProviderId <= 0 || availableCategoriesFlow.value.isEmpty()) returnshowCategoryListOverlayFlow.value = trueshowChannelListOverlayFlow.value = false+ showFullGuideOverlayFlow.value = falsescheduleLiveOverlayAutoHide()}@@ -43,16 +48,80 @@ fun PlayerViewModel.openEpgOverlay() {clearNumericChannelInput()showEpgOverlayFlow.value = trueshowChannelListOverlayFlow.value = false+ showFullGuideOverlayFlow.value = falseshowChannelInfoOverlayFlow.value = falseshowControlsFlow.value = falsescheduleLiveOverlayAutoHide()}+fun PlayerViewModel.openFullGuideOverlay() {+ if (currentContentType != ContentType.LIVE) return+ clearNumericChannelInput()+ showFullGuideOverlayFlow.value = true+ showChannelListOverlayFlow.value = false+ showCategoryListOverlayFlow.value = false+ showEpgOverlayFlow.value = false+ showChannelInfoOverlayFlow.value = false+ showDiagnosticsFlow.value = false+ showControlsFlow.value = false+ channelInfoHideJob?.cancel()+ clearLiveOverlayAutoHide()+ clearDiagnosticsAutoHide()+}++fun PlayerViewModel.closeFullGuideOverlay() {+ showFullGuideOverlayFlow.value = false+ playerEngine.setScrubbingMode(false)+}++fun PlayerViewModel.playChannelFromGuideOverlay(+ channel: Channel,+ selectedGuideCategoryId: Long,+ favoritesOnly: Boolean,+ combinedProfileId: Long?+) {+ if (currentContentType != ContentType.LIVE || channel.streamUrl.isBlank()) return+ val playbackCategoryId = when {+ favoritesOnly -> VirtualCategoryIds.FAVORITES+ selectedGuideCategoryId != ChannelRepository.ALL_CHANNELS_ID -> selectedGuideCategoryId+ else -> ChannelRepository.ALL_CHANNELS_ID+ }+ val categoryIsVirtual = playbackCategoryId == VirtualCategoryIds.FAVORITES || playbackCategoryId < 0L+ val currentListIndex = channelList.indexOfFirst { it.id == channel.id }++ clearNumericChannelInput()+ closeFullGuideOverlay()++ if (currentListIndex != -1) {+ changeChannel(currentListIndex)+ closeOverlays()+ playerEngine.setScrubbingMode(false)+ return+ }++ prepare(+ streamUrl = channel.streamUrl,+ epgChannelId = channel.epgChannelId,+ internalChannelId = channel.id,+ categoryId = playbackCategoryId,+ providerId = channel.providerId,+ isVirtual = categoryIsVirtual,+ combinedProfileId = combinedProfileId,+ contentType = ContentType.LIVE.name,+ title = channel.name,+ artworkUrl = channel.logoUrl,+ showResumePrompt = false+ )+ playerEngine.setScrubbingMode(false)+ closeOverlays()+}+fun PlayerViewModel.openChannelInfoOverlay() {clearNumericChannelInput()showChannelInfoOverlayFlow.value = trueshowChannelListOverlayFlow.value = falseshowEpgOverlayFlow.value = false+ showFullGuideOverlayFlow.value = falseshowControlsFlow.value = falsechannelInfoHideJob?.cancel()scheduleLiveOverlayAutoHide()@@ -69,6 +138,7 @@ fun PlayerViewModel.closeOverlays() {showChannelListOverlayFlow.value = falseshowCategoryListOverlayFlow.value = falseshowEpgOverlayFlow.value = false+ showFullGuideOverlayFlow.value = falseshowChannelInfoOverlayFlow.value = falseshowDiagnosticsFlow.value = falsechannelInfoHideJob?.cancel()diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.ktindex 6f2ec4b2..a0c36075 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt@@ -54,6 +54,8 @@ import com.streamvault.domain.model.StreamInfoimport com.streamvault.domain.model.VideoFormatimport com.streamvault.domain.model.Programimport com.streamvault.domain.repository.EpgRepository+import com.streamvault.domain.model.VirtualCategoryIds+import com.streamvault.domain.repository.ChannelRepositoryimport com.streamvault.player.PlaybackStateimport com.streamvault.player.PLAYER_TRACK_AUTO_IDimport com.streamvault.player.PlayerEngine@@ -103,6 +105,7 @@ import com.streamvault.app.ui.screens.player.overlay.PlayerAudioVideoOffsetDialoimport com.streamvault.app.ui.screens.player.overlay.PlayerSpeedSelectionDialogimport com.streamvault.app.ui.screens.player.overlay.PlayerSleepTimerDialogimport com.streamvault.app.ui.screens.player.overlay.PlayerSleepTimerWarningOverlay+import com.streamvault.app.ui.screens.player.overlay.PlayerTransparentGuideOverlayimport com.streamvault.app.ui.screens.player.overlay.StreamFormatSelectionDialogimport com.streamvault.app.ui.screens.player.overlay.NextEpisodeCountdownOverlayimport com.streamvault.app.ui.screens.multiview.MultiViewViewModel@@ -200,6 +203,7 @@ fun PlayerScreen(val parentalControlLevel by viewModel.parentalControlLevel.collectAsStateWithLifecycle()val activeCategoryId by viewModel.activeCategoryId.collectAsStateWithLifecycle()val showEpgOverlay by viewModel.showEpgOverlay.collectAsStateWithLifecycle()+ val showFullGuideOverlay by viewModel.showFullGuideOverlay.collectAsStateWithLifecycle()val currentChannelList by viewModel.currentChannelList.collectAsStateWithLifecycle()val recentChannels by viewModel.recentChannels.collectAsStateWithLifecycle()val lastVisitedCategory by viewModel.lastVisitedCategory.collectAsStateWithLifecycle()@@ -247,8 +251,10 @@ fun PlayerScreen(val playButtonFocusRequester = remember { FocusRequester() }val quickActionsFocusRequester = remember { FocusRequester() }val channelInfoFocusRequester = remember { FocusRequester() }+ val epgOverlayFocusRequester = remember { FocusRequester() }val layoutDirection = LocalLayoutDirection.currentval isRtl = layoutDirection == LayoutDirection.Rtl+ val openFullGuideFromEpgKeyCode = if (isRtl) KeyEvent.KEYCODE_DPAD_LEFT else KeyEvent.KEYCODE_DPAD_RIGHTval currentPictureInPictureMode by rememberUpdatedState(isInPictureInPictureMode)val enterPictureInPicture = remember(mainActivity) {{@@ -333,8 +339,14 @@ fun PlayerScreen(// Consolidated focus management for all overlaysval liveOverlayVisible = contentType == "LIVE" && (showChannelListOverlay || showCategoryListOverlay || showEpgOverlay || showChannelInfoOverlay)+ val guideNavigationContext = remember(activeCategoryId, currentChannel?.categoryId) {+ resolvePlayerGuideNavigationContext(+ activeCategoryId = activeCategoryId,+ currentChannelCategoryId = currentChannel?.categoryId+ )+ }val nextEpisodeCountdownVisible = !isInPictureInPictureMode && autoPlayCountdown != null- val anyOverlayVisible = liveOverlayVisible || nextEpisodeCountdownVisible || showTrackSelection != null || showVariantSelection || showStreamFormatSelection || showSpeedSelection || showAudioVideoOffsetDialog || showStopPlaybackTimerDialog || showIdleStandbyTimerDialog || showProgramHistory || showSplitDialog || showEpisodePicker || showDiagnostics+ val anyOverlayVisible = liveOverlayVisible || showFullGuideOverlay || nextEpisodeCountdownVisible || showTrackSelection != null || showVariantSelection || showStreamFormatSelection || showSpeedSelection || showAudioVideoOffsetDialog || showStopPlaybackTimerDialog || showIdleStandbyTimerDialog || showProgramHistory || showSplitDialog || showEpisodePicker || showDiagnosticsLaunchedEffect(contentType, showCategoryListOverlay, showChannelListOverlay, showEpgOverlay, showChannelInfoOverlay) {if (contentType == "LIVE" && (showCategoryListOverlay || showChannelListOverlay || showEpgOverlay || showChannelInfoOverlay)) {@@ -343,6 +355,7 @@ fun PlayerScreen(when {showCategoryListOverlay -> categoryListFocusRequester.requestFocusSafely(tag = "PlayerScreen", target = "Category list overlay")showChannelListOverlay -> channelListFocusRequester.requestFocusSafely(tag = "PlayerScreen", target = "Channel list overlay")+ showEpgOverlay -> epgOverlayFocusRequester.requestFocusSafely(tag = "PlayerScreen", target = "EPG overlay")showChannelInfoOverlay -> channelInfoFocusRequester.requestFocusSafely(tag = "PlayerScreen", target = "Channel info overlay")}}@@ -577,6 +590,7 @@ fun PlayerScreen(showChannelListOverlay,showCategoryListOverlay,showEpgOverlay,+ showFullGuideOverlay,showControls,numericChannelInput) {@@ -599,6 +613,7 @@ fun PlayerScreen(showStreamFormatSelection -> showStreamFormatSelection = falseshowTrackSelection != null -> showTrackSelection = nullshowDiagnostics -> viewModel.toggleDiagnostics()+ showFullGuideOverlay -> viewModel.closeFullGuideOverlay()showChannelInfoOverlay -> viewModel.closeChannelInfoOverlay()showChannelListOverlay || showCategoryListOverlay || showEpgOverlay -> viewModel.closeOverlays()showControls -> viewModel.toggleControls()@@ -655,6 +670,14 @@ fun PlayerScreen(if (contentType != "LIVE") {return@onPreviewKeyEvent false}+ if (showEpgOverlay && !isCatchUpPlayback && event.nativeKeyEvent.keyCode == openFullGuideFromEpgKeyCode) {+ viewModel.onLiveOverlayInteraction()+ viewModel.openFullGuideOverlay()+ return@onPreviewKeyEvent true+ }+ if (showFullGuideOverlay) {+ return@onPreviewKeyEvent false+ }if (showChannelListOverlay || showCategoryListOverlay || showEpgOverlay || showDiagnostics) {return@onPreviewKeyEvent false}@@ -767,6 +790,15 @@ fun PlayerScreen(else -> true}}+ if (showFullGuideOverlay) {+ return@onKeyEvent when (event.nativeKeyEvent.keyCode) {+ KeyEvent.KEYCODE_BACK -> {+ viewModel.closeFullGuideOverlay()+ true+ }+ else -> false+ }+ }when (event.nativeKeyEvent.keyCode) {KeyEvent.KEYCODE_PROG_RED,KeyEvent.KEYCODE_PROG_GREEN,@@ -837,7 +869,10 @@ fun PlayerScreen(viewModel.onLiveOverlayInteraction()}if (showControls && (contentType != "LIVE" || isCatchUpPlayback)) return@onKeyEvent false- if (contentType == "LIVE" && !isCatchUpPlayback && !showChannelListOverlay && !showEpgOverlay && !showChannelInfoOverlay) {+ if (contentType == "LIVE" && !isCatchUpPlayback && showEpgOverlay && event.nativeKeyEvent.keyCode == openFullGuideFromEpgKeyCode) {+ viewModel.openFullGuideOverlay()+ true+ } else if (contentType == "LIVE" && !isCatchUpPlayback && !showChannelListOverlay && !showEpgOverlay && !showChannelInfoOverlay) {if (isRtl) viewModel.openChannelListOverlay() else viewModel.openEpgOverlay()true} else if (!showChannelListOverlay && !showEpgOverlay && !showChannelInfoOverlay) {@@ -930,7 +965,7 @@ fun PlayerScreen(}KeyEvent.KEYCODE_GUIDE -> {if (contentType == "LIVE") {- viewModel.openEpgOverlay()+ viewModel.openFullGuideOverlay()true} else {false@@ -1307,6 +1342,60 @@ fun PlayerScreen()}+ if (!isInPictureInPictureMode && showFullGuideOverlay && contentType == "LIVE") {+ val guideViewModel: com.streamvault.app.ui.screens.epg.EpgViewModel = hiltViewModel()+ val guideUiState by guideViewModel.uiState.collectAsStateWithLifecycle()++ LaunchedEffect(showFullGuideOverlay, guideNavigationContext) {+ if (showFullGuideOverlay) {+ guideViewModel.applyNavigationContext(+ categoryId = guideNavigationContext.categoryId,+ anchorTime = System.currentTimeMillis(),+ favoritesOnly = guideNavigationContext.favoritesOnly+ )+ }+ }++ PlayerTransparentGuideOverlay(+ uiState = guideUiState,+ currentPlayerChannelId = currentChannel?.id ?: internalChannelId,+ onDismiss = viewModel::closeFullGuideOverlay,+ onJumpToNow = guideViewModel::jumpToNow,+ onSelectCategory = { category ->+ if (category.id == VirtualCategoryIds.FAVORITES) {+ guideViewModel.applyNavigationContext(+ categoryId = ChannelRepository.ALL_CHANNELS_ID,+ anchorTime = null,+ favoritesOnly = true+ )+ } else {+ guideViewModel.applyNavigationContext(+ categoryId = category.id,+ anchorTime = null,+ favoritesOnly = false+ )+ }+ },+ onSearchQueryChange = guideViewModel::updateProgramSearchQuery,+ onClearSearch = guideViewModel::clearProgramSearch,+ onWatchChannel = { channel ->+ viewModel.playChannelFromGuideOverlay(+ channel = channel,+ selectedGuideCategoryId = guideUiState.selectedCategoryId,+ favoritesOnly = guideUiState.showFavoritesOnly,+ combinedProfileId = guideUiState.combinedProfileId+ )+ },+ onWatchArchive = { channel, program ->+ if (channel.id == (currentChannel?.id ?: internalChannelId)) {+ viewModel.playCatchUp(program)+ }+ },+ onRequestMoreChannels = guideViewModel::requestMoreChannels,+ modifier = Modifier.fillMaxSize()+ )+ }+if (contentType == "LIVE") {AnimatedVisibility(visible = showChannelListOverlay,@@ -1374,6 +1463,8 @@ fun PlayerScreen(nextProgram = nextProgram,upcomingPrograms = upcomingPrograms,onDismiss = { viewModel.closeOverlays() },+ overlayFocusRequester = epgOverlayFocusRequester,+ onOpenFullGuide = { viewModel.openFullGuideOverlay() },onOpenArchiveBrowser = {showProgramHistory = trueviewModel.closeOverlays()diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.ktindex 0d5abbf4..eabfe913 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt@@ -176,6 +176,9 @@ class PlayerViewModel @Inject constructor(internal val showEpgOverlayFlow = MutableStateFlow(false)val showEpgOverlay: StateFlow<Boolean> = showEpgOverlayFlow.asStateFlow()+ internal val showFullGuideOverlayFlow = MutableStateFlow(false)+ val showFullGuideOverlay: StateFlow<Boolean> = showFullGuideOverlayFlow.asStateFlow()+internal val currentChannelFlowList = MutableStateFlow<List<com.streamvault.domain.model.Channel>>(emptyList())val currentChannelList: StateFlow<List<com.streamvault.domain.model.Channel>> = currentChannelFlowList.asStateFlow()diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerAuxiliaryOverlays.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerAuxiliaryOverlays.ktindex aceea555..746ef9ff 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerAuxiliaryOverlays.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerAuxiliaryOverlays.kt@@ -1,6 +1,7 @@package com.streamvault.app.ui.screens.player.overlayimport androidx.activity.compose.BackHandler+import android.view.KeyEventimport androidx.compose.animation.AnimatedVisibilityimport androidx.compose.animation.fadeInimport androidx.compose.animation.fadeOut@@ -464,12 +465,21 @@ fun EpgOverlay(nextProgram: Program?,upcomingPrograms: List<Program>,onDismiss: () -> Unit,+ overlayFocusRequester: FocusRequester = remember { FocusRequester() },+ onOpenFullGuide: (() -> Unit)? = null,onOpenArchiveBrowser: (() -> Unit)? = null,onOverlayInteracted: () -> Unit = {}) {val appTimeFormat = LocalAppTimeFormat.currentval timeFormat = remember(appTimeFormat) { appTimeFormat.createTimeFormat() }val listState = rememberLazyListState()+ val coroutineScope = rememberCoroutineScope()+ val layoutDirection = LocalLayoutDirection.current+ val openFullGuideKeyCode = if (layoutDirection == LayoutDirection.Rtl) {+ KeyEvent.KEYCODE_DPAD_LEFT+ } else {+ KeyEvent.KEYCODE_DPAD_RIGHT+ }val filteredUpcoming = remember(upcomingPrograms, currentProgram, nextProgram) {upcomingPrograms.filter { it.id != currentProgram?.id && it.id != nextProgram?.id }}@@ -482,6 +492,41 @@ fun EpgOverlay(Box(modifier = Modifier.fillMaxSize()+ .focusRequester(overlayFocusRequester)+ .focusable()+ .onPreviewKeyEvent { event ->+ if (event.nativeKeyEvent.action != KeyEvent.ACTION_DOWN) {+ return@onPreviewKeyEvent false+ }+ if (event.nativeKeyEvent.keyCode == openFullGuideKeyCode && onOpenFullGuide != null) {+ onOverlayInteracted()+ onOpenFullGuide()+ true+ } else {+ when (event.nativeKeyEvent.keyCode) {+ KeyEvent.KEYCODE_DPAD_DOWN -> {+ onOverlayInteracted()+ coroutineScope.launch {+ val nextIndex = (listState.firstVisibleItemIndex + 1)+ .coerceAtMost(listState.layoutInfo.totalItemsCount - 1)+ if (nextIndex >= 0) {+ listState.animateScrollToItem(nextIndex, listState.firstVisibleItemScrollOffset)+ }+ }+ true+ }+ KeyEvent.KEYCODE_DPAD_UP -> {+ onOverlayInteracted()+ coroutineScope.launch {+ val previousIndex = (listState.firstVisibleItemIndex - 1).coerceAtLeast(0)+ listState.animateScrollToItem(previousIndex, listState.firstVisibleItemScrollOffset)+ }+ true+ }+ else -> false+ }+ }+ }.background(Color.Black.copy(alpha = 0.18f))) {BoxWithConstraints(@@ -701,6 +746,26 @@ fun EpgOverlay(}}}++ if (onOpenFullGuide != null) {+ Box(+ modifier = Modifier+ .align(if (layoutDirection == LayoutDirection.Rtl) Alignment.CenterStart else Alignment.CenterEnd)+ .padding(horizontal = 8.dp)+ .width(24.dp)+ .height(72.dp)+ .clip(RoundedCornerShape(8.dp))+ .background(Primary.copy(alpha = 0.58f)),+ contentAlignment = Alignment.Center+ ) {+ Text(+ text = if (layoutDirection == LayoutDirection.Rtl) "<" else ">",+ style = MaterialTheme.typography.titleMedium,+ color = Color.White.copy(alpha = 0.92f),+ fontWeight = FontWeight.Bold+ )+ }+ }}}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerTransparentGuideOverlay.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerTransparentGuideOverlay.ktnew file mode 100644index 00000000..5624874d--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerTransparentGuideOverlay.kt@@ -0,0 +1,309 @@+package com.streamvault.app.ui.screens.player.overlay++import androidx.activity.compose.BackHandler+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.fillMaxSize+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.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Brush+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.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Text+import com.streamvault.app.R+import com.streamvault.app.ui.model.isArchivePlayable+import com.streamvault.app.ui.screens.epg.CompactGuideProgramDialog+import com.streamvault.app.ui.screens.epg.EpgGrid+import com.streamvault.app.ui.screens.epg.EpgUiState+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.app.ui.screens.epg.GuideNowProvider+import com.streamvault.app.ui.screens.epg.GuideSearchOverlay+import com.streamvault.app.ui.screens.epg.GuideToolbarButton+import com.streamvault.app.ui.screens.epg.currentGuideNow+import com.streamvault.app.ui.screens.epg.isGuideCategoryLocked+import com.streamvault.app.ui.theme.OnSurfaceDim+import com.streamvault.app.ui.theme.Primary+import com.streamvault.domain.model.Category+import com.streamvault.domain.model.Channel+import com.streamvault.domain.model.Program+import com.streamvault.domain.model.VirtualCategoryIds+import java.text.SimpleDateFormat+import java.util.Date+import java.util.Locale++@Composable+fun PlayerTransparentGuideOverlay(+ uiState: EpgUiState,+ currentPlayerChannelId: Long,+ onDismiss: () -> Unit,+ onJumpToNow: () -> Unit,+ onSelectCategory: (Category) -> Unit,+ onSearchQueryChange: (String) -> Unit,+ onClearSearch: () -> Unit,+ onWatchChannel: (Channel) -> Unit,+ onWatchArchive: (Channel, Program) -> Unit,+ onRequestMoreChannels: () -> Unit,+ modifier: Modifier = Modifier+) {+ var focusedChannel by remember(uiState.channels, currentPlayerChannelId) {+ mutableStateOf(uiState.channels.firstOrNull { it.id == currentPlayerChannelId } ?: uiState.channels.firstOrNull())+ }+ var focusedProgram by remember { mutableStateOf<Program?>(null) }+ var selectedProgram by remember { mutableStateOf<Pair<Channel, Program>?>(null) }+ var showCategoryPicker by remember { mutableStateOf(false) }+ var showSearchOverlay by remember { mutableStateOf(false) }++ BackHandler(onBack = onDismiss)++ GuideNowProvider {+ val now = currentGuideNow()+ val headerDateFormat = remember { SimpleDateFormat("EEE, MMM d, h:mm a", Locale.getDefault()) }+ val headerTitle = focusedProgram?.title ?: focusedChannel?.name ?: stringResource(R.string.epg_title)+ val favoritesLabel = stringResource(R.string.epg_favorites_filter_favorites)+ val selectedPickerCategoryId = if (uiState.showFavoritesOnly) {+ VirtualCategoryIds.FAVORITES+ } else {+ uiState.selectedCategoryId+ }+ val selectedCategoryName = remember(+ uiState.categories,+ uiState.selectedCategoryId,+ uiState.showFavoritesOnly,+ favoritesLabel+ ) {+ if (uiState.showFavoritesOnly) {+ favoritesLabel+ } else {+ uiState.categories+ .firstOrNull { it.id == uiState.selectedCategoryId }+ ?.name+ .orEmpty()+ }+ }+ val contextLabel = remember(+ uiState.providerSourceLabel,+ selectedCategoryName+ ) {+ listOf(uiState.providerSourceLabel, selectedCategoryName)+ .filter { it.isNotBlank() }+ .joinToString(" | ")+ }++ Box(+ modifier = modifier+ .fillMaxSize()+ .background(+ Brush.verticalGradient(+ colors = listOf(+ Color.Black.copy(alpha = 0.30f),+ Color.Black.copy(alpha = 0.12f),+ Color.Black.copy(alpha = 0.22f)+ )+ )+ )+ ) {+ Surface(+ modifier = Modifier+ .align(Alignment.TopStart)+ .fillMaxWidth()+ .padding(start = 18.dp, top = 16.dp, end = 18.dp),+ shape = RoundedCornerShape(18.dp),+ colors = SurfaceDefaults.colors(+ containerColor = Color.Black.copy(alpha = 0.32f)+ )+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(4.dp)+ ) {+ Text(+ text = headerDateFormat.format(Date(now)),+ style = MaterialTheme.typography.labelMedium,+ color = Primary+ )+ Text(+ text = headerTitle,+ style = MaterialTheme.typography.titleMedium,+ color = Color.White,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ if (contextLabel.isNotBlank()) {+ Text(+ text = contextLabel,+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ }+ }++ Row(+ horizontalArrangement = Arrangement.spacedBy(8.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ GuideToolbarButton(+ label = selectedCategoryName.ifBlank { stringResource(R.string.epg_filter_short) },+ modifier = Modifier.widthIn(min = 180.dp, max = 280.dp),+ onClick = { showCategoryPicker = true },+ onFocused = {}+ )+ GuideToolbarButton(+ label = stringResource(R.string.epg_jump_now),+ onClick = onJumpToNow,+ onFocused = {}+ )+ GuideToolbarButton(+ label = stringResource(R.string.epg_search_label),+ onClick = { showSearchOverlay = true },+ onFocused = {}+ )+ GuideToolbarButton(+ label = stringResource(R.string.settings_cancel),+ onClick = onDismiss,+ onFocused = {}+ )+ }+ }+ }++ Box(+ modifier = Modifier+ .fillMaxSize()+ .padding(start = 18.dp, top = 112.dp, end = 18.dp, bottom = 16.dp)+ .clip(RoundedCornerShape(24.dp))+ .background(Color.Black.copy(alpha = 0.16f))+ ) {+ when {+ uiState.isInitialLoading -> {+ GuideMessageState(+ title = stringResource(R.string.epg_loading),+ subtitle = contextLabel.takeIf { it.isNotBlank() },+ actionLabel = null,+ onAction = null+ )+ }+ uiState.channels.isEmpty() -> {+ GuideMessageState(+ title = stringResource(R.string.epg_title),+ subtitle = uiState.error+ ?.takeUnless { it == EpgViewModel.NO_ACTIVE_PROVIDER }+ ?: stringResource(R.string.epg_no_schedule),+ actionLabel = null,+ onAction = null+ )+ }+ else -> {+ EpgGrid(+ channels = uiState.channels,+ favoriteChannelIds = uiState.favoriteChannelIds,+ programsByChannel = uiState.programsByChannel,+ guideWindowStart = uiState.guideWindowStart,+ guideWindowEnd = uiState.guideWindowEnd,+ density = uiState.selectedDensity,+ transparentOverlay = true,+ initialFocusedChannelId = currentPlayerChannelId.takeIf { it > 0L },+ onChannelClick = { channel ->+ onWatchChannel(channel)+ onDismiss()+ },+ onProgramClick = { channel, program ->+ selectedProgram = channel to program+ },+ onChannelFocused = { channel, program, _ ->+ focusedChannel = channel+ focusedProgram = program+ },+ onProgramFocused = { channel, program, _ ->+ focusedChannel = channel+ focusedProgram = program+ },+ onRequestMoreChannels = onRequestMoreChannels,+ modifier = Modifier.fillMaxSize()+ )+ }+ }+ }+ }++ if (showCategoryPicker) {+ GuideCategoryPickerDialog(+ categories = uiState.categories,+ selectedCategoryId = selectedPickerCategoryId,+ parentalControlLevel = uiState.parentalControlLevel,+ onDismiss = { showCategoryPicker = false },+ onCategorySelected = { category ->+ if (!isGuideCategoryLocked(category, uiState.parentalControlLevel)) {+ showCategoryPicker = false+ onSelectCategory(category)+ }+ }+ )+ }++ if (showSearchOverlay) {+ GuideSearchOverlay(+ query = uiState.programSearchQuery,+ onQueryChange = onSearchQueryChange,+ onClear = onClearSearch,+ onDismiss = { showSearchOverlay = false }+ )+ }++ selectedProgram?.let { (channel, program) ->+ val canWatchArchive = channel.id == currentPlayerChannelId && channel.isArchivePlayable(program, now)+ CompactGuideProgramDialog(+ channel = channel,+ program = program,+ providerLabel = uiState.providerSourceLabel,+ now = now,+ onDismiss = { selectedProgram = null },+ onWatchLive = {+ selectedProgram = null+ onWatchChannel(channel)+ onDismiss()+ },+ onWatchArchive = if (canWatchArchive) {+ {+ selectedProgram = null+ onWatchArchive(channel, program)+ onDismiss()+ }+ } else {+ null+ },+ reminderButtonLabel = null,+ onToggleReminder = null,+ onScheduleRecording = null,+ onScheduleDailyRecording = null,+ onScheduleWeeklyRecording = null+ )+ }+ }+}diff --git a/app/src/test/java/com/streamvault/app/ui/screens/player/PlayerGuideOverlaySupportTest.kt b/app/src/test/java/com/streamvault/app/ui/screens/player/PlayerGuideOverlaySupportTest.ktnew file mode 100644index 00000000..155b9917--- /dev/null+++ b/app/src/test/java/com/streamvault/app/ui/screens/player/PlayerGuideOverlaySupportTest.kt@@ -0,0 +1,56 @@+package com.streamvault.app.ui.screens.player++import com.streamvault.domain.model.VirtualCategoryIds+import com.streamvault.domain.repository.ChannelRepository+import org.junit.Assert.assertEquals+import org.junit.Test++class PlayerGuideOverlaySupportTest {++ @Test+ fun `all channels anchors overlay to current channel category when available`() {+ assertEquals(+ PlayerGuideNavigationContext(categoryId = 42L, favoritesOnly = false),+ resolvePlayerGuideNavigationContext(+ activeCategoryId = ChannelRepository.ALL_CHANNELS_ID,+ currentChannelCategoryId = 42L+ )+ )+ }++ @Test+ fun `all channels falls back to explicit all channels when channel category is unavailable`() {+ assertEquals(+ PlayerGuideNavigationContext(categoryId = ChannelRepository.ALL_CHANNELS_ID, favoritesOnly = false),+ resolvePlayerGuideNavigationContext(+ activeCategoryId = ChannelRepository.ALL_CHANNELS_ID,+ currentChannelCategoryId = null+ )+ )+ }++ @Test+ fun `favorites category maps to favorites only guide mode`() {+ assertEquals(+ PlayerGuideNavigationContext(+ categoryId = ChannelRepository.ALL_CHANNELS_ID,+ favoritesOnly = true+ ),+ resolvePlayerGuideNavigationContext(+ activeCategoryId = VirtualCategoryIds.FAVORITES,+ currentChannelCategoryId = 42L+ )+ )+ }++ @Test+ fun `real category keeps explicit category id`() {+ assertEquals(+ PlayerGuideNavigationContext(categoryId = 42L, favoritesOnly = false),+ resolvePlayerGuideNavigationContext(+ activeCategoryId = 42L,+ currentChannelCategoryId = 99L+ )+ )+ }+}