From 535ed87dd267bd1c64098540e959b5d0e9fbdc1a Mon Sep 17 00:00:00 2001 From: Damontecres Date: Tue, 21 Oct 2025 15:50:11 -0400 Subject: [PATCH] Add back press to jump to beginning --- .../wholphin/ui/detail/livetv/TvGuideGrid.kt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/detail/livetv/TvGuideGrid.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/detail/livetv/TvGuideGrid.kt index f050a17c..c94aaa40 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/detail/livetv/TvGuideGrid.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/detail/livetv/TvGuideGrid.kt @@ -227,6 +227,17 @@ fun TvGuideGrid( } val newIndex = when (it.key) { + Key.Back -> { + val pos = programsBeforeChannel.get(focusedChannelIndex) + if (focusedProgramIndex - pos > 0) { + // Not at beginning of row, so move to beginning + pos + } else { + // At beginning, so allow normal back button behavior + return@onPreviewKeyEvent false + } + } + Key.DirectionRight -> { val nextProgramIndex = focusedProgramIndex + 1 val programsBefore = programsBeforeChannel.get(focusedChannelIndex) @@ -358,7 +369,7 @@ fun TvGuideGrid( }, ) { Surface( - colors = SurfaceDefaults.colors(MaterialTheme.colorScheme.tertiary.copy(alpha = .5f)), + colors = SurfaceDefaults.colors(MaterialTheme.colorScheme.tertiary.copy(alpha = .25f)), modifier = Modifier, ) { // Empty @@ -377,7 +388,7 @@ fun TvGuideGrid( modifier = Modifier .fillMaxSize() - .background(MaterialTheme.colorScheme.background), + .background(MaterialTheme.colorScheme.surface), ) { val differentDay = start.toLocalDate() != @@ -474,7 +485,7 @@ fun TvGuideGrid( Modifier .fillMaxSize() .background( - MaterialTheme.colorScheme.background, + MaterialTheme.colorScheme.surface, shape = RoundedCornerShape(4.dp), ), ) {