mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Fix two home row focus bugs (#1376)
## Description 1. Fixes when moving from nav drawer to home page content, focus would sometimes move up a row 2. Fixes when moving up/down between rows, focus would sometimes move to the later card (usually the last visible) The second above is fixed by downgrading `tv-material` to `1.0.1-alpha01`. Switching to [`1.0.1-beta01`](https://developer.android.com/jetpack/androidx/releases/tv#tv-material-1.1.0-beta01) or newer causes the bug. Not clear if its a bug in the library or Wholphin though. ### Related issues Fixes #1359 ### Testing Emulator ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
4928c1156d
commit
8b9b0ddec8
2 changed files with 11 additions and 2 deletions
|
|
@ -31,6 +31,7 @@ import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.focus.FocusRequester
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
|
import androidx.compose.ui.focus.focusProperties
|
||||||
import androidx.compose.ui.focus.focusRequester
|
import androidx.compose.ui.focus.focusRequester
|
||||||
import androidx.compose.ui.focus.focusRestorer
|
import androidx.compose.ui.focus.focusRestorer
|
||||||
import androidx.compose.ui.focus.onFocusChanged
|
import androidx.compose.ui.focus.onFocusChanged
|
||||||
|
|
@ -307,7 +308,15 @@ fun HomePageContent(
|
||||||
focusedItem?.let { onUpdateBackdrop.invoke(it) }
|
focusedItem?.let { onUpdateBackdrop.invoke(it) }
|
||||||
}
|
}
|
||||||
Box(modifier = modifier) {
|
Box(modifier = modifier) {
|
||||||
Column(modifier = Modifier.fillMaxSize()) {
|
Column(
|
||||||
|
modifier =
|
||||||
|
Modifier
|
||||||
|
.focusProperties {
|
||||||
|
onEnter = {
|
||||||
|
rowFocusRequesters.getOrNull(currentPosition.row)?.tryRequestFocus()
|
||||||
|
}
|
||||||
|
}.fillMaxSize(),
|
||||||
|
) {
|
||||||
headerComposable.invoke(focusedItem)
|
headerComposable.invoke(focusedItem)
|
||||||
|
|
||||||
val density = LocalDensity.current
|
val density = LocalDensity.current
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ programguide = "1.6.0"
|
||||||
slf4j2Timber = "1.2"
|
slf4j2Timber = "1.2"
|
||||||
timber = "5.0.1"
|
timber = "5.0.1"
|
||||||
tvFoundation = "1.0.0"
|
tvFoundation = "1.0.0"
|
||||||
tvMaterial = "1.1.0"
|
tvMaterial = "1.1.0-alpha01"
|
||||||
lifecycleRuntimeKtx = "2.10.0"
|
lifecycleRuntimeKtx = "2.10.0"
|
||||||
activityCompose = "1.13.0"
|
activityCompose = "1.13.0"
|
||||||
androidx-media3 = "1.10.0"
|
androidx-media3 = "1.10.0"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue