Status Update
Comments
so...@google.com <so...@google.com> #2
Branch: androidx-main
commit 924b7e11734c0cd506a496f448e1a96b7b86ee68
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Feb 02 14:19:35 2022
Take CreationExtras in activity viewModel function
Add function to take CreationExtras in the viewModels -ktx extension
function.
RelNote: "You can now pass `CreationExtras` to the activity by
viewModels function"
Test: ActivityViewModelLazyTest
Bug: 217600303
Change-Id: I6a3e64fb4ec1c18510ab5f45b3533de586f50d77
M activity/activity-ktx/api/current.txt
M activity/activity-ktx/api/restricted_current.txt
M activity/activity-ktx/api/api_lint.ignore
M activity/activity-ktx/src/main/java/androidx/activity/ActivityViewModelLazy.kt
M activity/activity-ktx/api/public_plus_experimental_current.txt
M activity/activity-ktx/src/androidTest/java/androidx/activity/ActivityViewModelLazyTest.kt
si...@gmail.com <si...@gmail.com> #3
This has been added internally and will be available in the Activity 1.5.0-alpha03
release.
br...@gmail.com <br...@gmail.com> #4
le...@google.com <le...@google.com> #5
This is now "fixed" for two of the examples:
-
semantics: this will now skip so long as the lambda is memoized, which will be the case for captureless lambdas or lambdas which do not capture non-stable types. We also just created an experimental "strong skipping mode" which would memoize lambdas even for non-stable capture scopes.
-
pointerInput: this will skip if the keys are unchanged (
Unit
in the above example).
Next, for Modifier.testTag
, this is an easy fix (which we should do), by just creating a custom modifier element or modifier node instead of using the lambda-based modifier.semantics factory.
Finally, for Modifier.clickable
and Modifier.selectable
, these use Modifier.composed
which is what is breaking the skipping. Clickable at least is actively being worked on to remove this, and selectable will likely follow.
Assigning to @lp...@google.com who is working on clickable, and cc'ing @ra...@google.com who i am hoping can make the change to Modifier.testTag
ap...@google.com <ap...@google.com> #6
Branch: androidx-main
commit 4b988b1fbd3827d298078f7b842c792078d03370
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Mon Dec 11 21:48:33 2023
Migrates testTag to Modifier.Node
This will allow testTag to skip when the tag stays the same
Fixes:
Bug:
Test: existing tests
Change-Id: Icec672b1b53c0df1d2c8777b91d39969c4905e74
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TestTag.kt
do...@xtb.com <do...@xtb.com> #7
lp...@google.com <lp...@google.com> #8
There have been a lot of optimizations to clickable / selectable / toggleable that will land in the next release. Skipping should be possible for the overloads with a required interaction source / indication, but not for the version without - so it is recommended use the version with a required interaction source
ap...@google.com <ap...@google.com> #9
Branch: androidx-main
commit ee9002567eaee5ca0f99be5edaa8ffca999befd2
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Fri Dec 22 03:26:45 2023
Refactors selectable / toggleable / triStateToggleable to use clickable node
Also merges semantics logic into clickable node directly.
Bug:
Bug:
Test: existing tests
Change-Id: I041d0f0d1af1cf484bc2ceab0e4d9d7c994b8b4c
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Clickable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Focusable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Selectable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Toggleable.kt
Description
Jetpack Compose version: 1.2.0
Android Studio Build: Android Studio Electric Eel | 2022.1.1 Canary 8
Kotlin version: 1.7.0
Code Sample to Reproduce:
Logs after a few clicks on the button:
Is this an expected behavior? If yes, what's the reason for that and why we can't skip the recomposition?