mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Add back press to jump to beginning
This commit is contained in:
parent
80b766f469
commit
535ed87dd2
1 changed files with 14 additions and 3 deletions
|
|
@ -227,6 +227,17 @@ fun TvGuideGrid(
|
||||||
}
|
}
|
||||||
val newIndex =
|
val newIndex =
|
||||||
when (it.key) {
|
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 -> {
|
Key.DirectionRight -> {
|
||||||
val nextProgramIndex = focusedProgramIndex + 1
|
val nextProgramIndex = focusedProgramIndex + 1
|
||||||
val programsBefore = programsBeforeChannel.get(focusedChannelIndex)
|
val programsBefore = programsBeforeChannel.get(focusedChannelIndex)
|
||||||
|
|
@ -358,7 +369,7 @@ fun TvGuideGrid(
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
colors = SurfaceDefaults.colors(MaterialTheme.colorScheme.tertiary.copy(alpha = .5f)),
|
colors = SurfaceDefaults.colors(MaterialTheme.colorScheme.tertiary.copy(alpha = .25f)),
|
||||||
modifier = Modifier,
|
modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
// Empty
|
// Empty
|
||||||
|
|
@ -377,7 +388,7 @@ fun TvGuideGrid(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(MaterialTheme.colorScheme.background),
|
.background(MaterialTheme.colorScheme.surface),
|
||||||
) {
|
) {
|
||||||
val differentDay =
|
val differentDay =
|
||||||
start.toLocalDate() !=
|
start.toLocalDate() !=
|
||||||
|
|
@ -474,7 +485,7 @@ fun TvGuideGrid(
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(
|
.background(
|
||||||
MaterialTheme.colorScheme.background,
|
MaterialTheme.colorScheme.surface,
|
||||||
shape = RoundedCornerShape(4.dp),
|
shape = RoundedCornerShape(4.dp),
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue