mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
app: keep dpad focus in content on rail
With a navigation rail there is nothing below the page, yet pressing DPAD_DOWN on the last focusable item let the 2D focus search leave the page and land on a rail item to the side. Cancel downward exits from the page in rail mode; moving to the rail is still possible with DPAD_LEFT. The bottom bar keeps its existing focus handling. Assisted-by: Claude Opus 5.5
This commit is contained in:
@@ -222,9 +222,12 @@ fun MainScreen(
|
||||
}
|
||||
}
|
||||
onExit = {
|
||||
if (requestedFocusDirection == FocusDirection.Up || (isBar &&
|
||||
(requestedFocusDirection == FocusDirection.Left ||
|
||||
requestedFocusDirection == FocusDirection.Right))
|
||||
// With a rail, nothing is below the page, so don't let DPAD_DOWN
|
||||
// jump into the rail; leaving to the rail is done with DPAD_LEFT.
|
||||
val dir = requestedFocusDirection
|
||||
if (dir == FocusDirection.Up ||
|
||||
(!isBar && dir == FocusDirection.Down) ||
|
||||
(isBar && (dir == FocusDirection.Left || dir == FocusDirection.Right))
|
||||
) {
|
||||
cancelFocusChange()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user