Status Update
Comments
ju...@google.com <ju...@google.com>
nj...@google.com <nj...@google.com>
ap...@google.com <ap...@google.com> #2
Please ensure this works with LazyColumn
, LazyRow
and LazyVerticalGrid
when this change is implemented. Thanks!
ap...@google.com <ap...@google.com> #3
Thanks Nick, LazyList is the internal component that all these composables are built out of.
ap...@google.com <ap...@google.com> #4
If I could add a small additional feature request here:
Hopefully the implementation of focus scrolling in lazy lists leaves room for the easy customization / overriding of the behavior, since TV UI often has unique snapping requirements around the focused item.
I've started to come up with my own compose API for this, and while I'm happy with the results so far, I'm hoping that any future built-in scrolling functionality will play nicely with it, or as a better alternative - provide all of the necessary configurations.
ap...@google.com <ap...@google.com> #5
To add a specific case to #4's comment on configurability:
In View Android apps, scrolling typically occurs once focus is moved to an item outside the viewport. With such behavior, however, the user is given no indication that there are more items to see. To solve this, it would be useful to be able to specify a scroll offset or similar that triggers scrolling even before reaching an item that is outside of the scroll viewport. This could for instance be a fixed dp value or .5
"list item heights" ahead. That way, the user would be informed that there is more to see.
In any case, glad to see this being of high priority!
ap...@google.com <ap...@google.com> #6
Looks like focus support for LazyLists did not make it to 1.1.0-beta01
.
Custom implementation that scrolls a LazyList to bring the focused element to view still almost works, but occasionally the focus moves to a random input node. The random input node can be uninitialized causing an exception at:
2021-11-01 09:54:51.247 E/MessageQueue-JNI: java.lang.IllegalStateException: KeyEvent can't be processed because this key input node is not active.
at androidx.compose.ui.input.key.KeyInputModifier.processKeyInput-ZmokQxo(KeyInputModifier.kt:75)
at androidx.compose.ui.platform.AndroidComposeView.sendKeyEvent-ZmokQxo(AndroidComposeView.android.kt:439)
at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:446)
ap...@google.com <ap...@google.com> #7
Apologies for pinging this thread. I'm also having the IllegalState exception issue from above. Should this be pulled out into a separate ticket as opposed to part of this one or is it all sort of the same thing? From our perspective we can get by with a custom implementation similar to above if it's stable (until the out of the box implementation is sorted later on).
As an aside thanks for all your hard work on this. Compose is a pleasure to work with!
ap...@google.com <ap...@google.com> #8
<3
nj...@google.com <nj...@google.com>
ap...@google.com <ap...@google.com> #9
Branch: androidx-main
commit ef81023fc0de83421e4779f6bef8e14d4ef6a158
Author: Ralston Da Silva <ralu@google.com>
Date: Mon Feb 14 18:00:04 2022
Refactor focus search to accept a lambda
Refactoring the focus search code so that it runs a lambda
once it finds the next item. This is needed so that we can
request focus on the next item when the next item is beyond
visible bounds. We need this because beyond bounds layout
requests return a block and the items are guaranteed to be
available only within the scope of the block.
For more info, see go/compose-focus-beyondbounds
Bug: 184670295
Test: Internal refactoring, existing moveFocus() tests
Change-Id: I6545ef1a094f5bbe37eb6f861d1ea5ab6a7ec926
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/OneDimensionalFocusSearch.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusTraversal.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusManager.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/TwoDimensionalFocusSearch.kt
pr...@google.com <pr...@google.com> #10
Branch: androidx-main
commit 3b4ce572c2fa394843ff0082cc985c8d02228560
Author: Ralston Da Silva <ralu@google.com>
Date: Tue Feb 15 16:57:08 2022
BeyondBoundsLayout ModifierLocal
This CL adds a BeyondBoundsLayout modifier local.
Bug: 184670295
Test: ./gradlew compose:ui:ui:cC -P android.testInstrumentationRunnerArguments.class=androidx.compose.ui.layout.BeyondBoundsLayoutTest
Relnote: Added a BeyondBoundsLayout modifier local
Change-Id: If8b51c6e08a375d1c733588e53c9b07474c0855c
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/BeyondBoundsLayoutTest.kt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/api/current.txt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout.kt
M compose/ui/ui/api/public_plus_experimental_current.txt
tj...@gmail.com <tj...@gmail.com> #11
Branch: androidx-main
commit e5cb882c220a13f87054aa5ddcf6410b59c12d9a
Author: Ralston Da Silva <ralu@google.com>
Date: Fri Feb 11 14:11:09 2022
Adding Focus Group API
Add an API to specify groups of composables that should be treated
as a focus group. ie, we give priority to the items within the group
before we move focus to items outside the group.
Bug: 213508274
Bug: 184670295
Test: ./gradlew compose:f:f:cC -P android.testInstrumentationRunnerArguments.class=androidx.compose.foundation.focus.FocusGroupTest
Relnote: Added FocusGroup modifier
Change-Id: I64bc0b945bf172ad37b64d011d7055f4a99bfeca
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Focusable.kt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
A compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/focus/FocusDemos.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/FocusGroupTest.kt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/FocusableSample.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/FoundationDemos.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/FocusableTest.kt
tj...@gmail.com <tj...@gmail.com> #12
Branch: androidx-main
commit fec4977a16aec28d1f56b80a941c4890189e35bc
Author: Ralston Da Silva <ralu@google.com>
Date: Wed Mar 16 01:15:29 2022
Change BeyondBoundsLayout API
The current API accepts two lambdas. This simplifies
it so that we use only one lambda parameter.
Bug: 184670295
Test: ./gradlew compose:ui:ui:cC -P android.testInstrumentationRunnerArguments.class=androidx.compose.ui.layout.BeyondBoundsLayoutTest
Relnote: N/A
Change-Id: Ic41edde9b83cd5f3a602f332e5f441cd00b0be47
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/BeyondBoundsLayoutTest.kt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/api/current.txt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout.kt
M compose/ui/ui/api/public_plus_experimental_current.txt
ap...@google.com <ap...@google.com> #13
Branch: androidx-main
commit 137c8716674d40eaf9411819e8e5632a7653cb08
Author: Ralston Da Silva <ralu@google.com>
Date: Mon Mar 14 13:55:18 2022
Make Scrollable a focusGroup
This CL makes scrollable a focus group, which ensures that we visit
all the items in the scrollable before moving to the next focus group.
Textfield has a scrollable that is added before the focus modifier.
This causes issues with FocusRequester - The focusRequester is
associated with the focusGroup instead of the focusModifier. This
also causes issues with onFocusChanged observers that would see the
state of the deactivated focus modifier within the focusGroup instead
of the focus state of the focus modifier. I solved these issues by
swapping the order of the scrollable and focusModifier in CoreTextField.
Bug: 184670295
Test: ./gradlew compose:f:f:cC -P android.testInstrumentationRunnerArguments.class=androidx.compose.foundation.ScrollableTest
Change-Id: I149acc64301086f0fd69a99f1e3c816259637367
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Focusable.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
na...@google.com <na...@google.com> #14
Branch: androidx-main
commit e062417461d8b52a759fab284fdf771c1046f87b
Author: Ralston Da Silva <ralu@google.com>
Date: Thu Mar 17 15:02:33 2022
Adding a PinnableParent ModifierLocal
LazyLists provide a PinnableParent that can be used by components like
focusable to prevent the currently composed children from being disposed.
This CL introduces the PinnableParent interface that will later be
implemented by LazyList, LazyGrid etc.
Bug: 184670295
Test: ./gradlew compose:f:f:cC -P android.testInstrumentationRunnerArguments.class=androidx.compose.foundation.FocusableTest
Test: ./gradlew compose:f:f:cC -P android.testInstrumentationRunnerArguments.class=androidx.compose.foundation.lazy.layout.PinRequesterTest
Relnote: Added a PinnableParent API that allows children of lazy layouts to prevent the currently composed items from being disposed
Change-Id: Ibbdd02b0d25db2e0de343d5d2278287ab1991831
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Focusable.kt
A compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/PinnableParent.kt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/PinnableParentTest.kt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/FocusableSample.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/FocusableTest.kt
Description
Per Nader's suggestion, `OwnedLayer` is already being used for handling drawing and is in commonMain. If we expose a subset of functionalities of `OwnedLayer`, shared element will be able to leverage their existing layer and render it elsewhere.