Status Update
Comments
ja...@gmail.com <ja...@gmail.com> #2
Hi, thank you for filing this ticket, we are planning to make this change in a 1.3.0 release.
ma...@google.com <ma...@google.com> #3
Thanks to you as well for receiving the feedback.
g0...@gmail.com <g0...@gmail.com> #4
I think, clickable
/combinedClickable
must be replaced with separated modifiers (as focus...
/onFocus...
). I propose to make:
- new
pressable(enabled, interactionSource)
modifier which does not have anindication
,hoverable
andfocusable
/focusableInNonTouchMode
.interactionSource
will only be used withPressInteraction
. - new modifier(s) for
onClickLabel
/onClick
,onLongClickLabel
/onLongClick
andonDoubleClick
. focusableInNonTouchMode
public.
We can add role
separately via semantics
.
All this will help to create components with the necessary properties.
lp...@google.com <lp...@google.com> #5
R.e
ap...@google.com <ap...@google.com> #6
Branch: androidx-main
commit c3c96aef1d6c366ee1658cd8dfa27588231740c2
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Thu Sep 28 16:59:45 2023
Deprecates rememberRipple and RippleTheme, adds createRippleNode API
This CL adds a new ripple implementation (createRippleNode) built using Modifier.Node APIs, so it can be used inside IndicationNodeFactory.
This leads to large performance improvements and greatly reduced allocations.
IndicationNodeFactory does not support calling Composable functions, so RippleTheme cannot be used to theme ripples built using the new node
APIs. In addition, having one singular library as the source of truth for ripple theme leads to tension and problems between design systems:
for example the default RippleTheme functions are actually the material spec, not material3, so they should have been versioned with the
material library instead. Similarly, if you are wrapping material / material3 with your own theme, both themes will end up 'fighting' over the
RippleTheme - the theme configuration is a property of the design system, not a generic system.
As a result, this CL deprecates rememberRipple and RippleTheme - the intention moving forward is for design system libraries to provide their
own theming APIs for ripples (if desired), and their own ripple Indication implementations that consume their own theme values. This allows us
to simplify the layering and API shape, and allows for more flexibility between custom design systems. createRippleNode encapsulates all of
the ripple logic so design system implementations can just delegate to createRippleNode after querying their theme values in a separate node.
Bug:
Test: RememberRippleTest, RippleModifierNodeTest, RippleBenchmark
Relnote: "Deprecates rememberRipple, RippleTheme and LocalRippleTheme, adds createRippleNode. Instead of using these APIs, use the new ripple Indication and theming APIs in design system libraries such as material / material3. See
Change-Id: I23f260b2f070e3f0f5b145b87eb1c6a06f3fd861
M compose/material/material-ripple/api/current.txt
M compose/material/material-ripple/api/restricted_current.txt
M compose/material/material-ripple/benchmark/src/androidTest/java/androidx/compose/material/ripple/benchmark/RippleBenchmark.kt
M compose/material/material-ripple/build.gradle
A compose/material/material-ripple/src/androidInstrumentedTest/kotlin/androidx/compose/material/ripple/RememberRippleTest.kt
M compose/material/material-ripple/src/androidInstrumentedTest/kotlin/androidx/compose/material/ripple/RippleContainerTest.kt
A compose/material/material-ripple/src/androidInstrumentedTest/kotlin/androidx/compose/material/ripple/RippleModifierNodeTest.kt
M compose/material/material-ripple/src/androidMain/kotlin/androidx/compose/material/ripple/Ripple.android.kt
M compose/material/material-ripple/src/androidMain/kotlin/androidx/compose/material/ripple/RippleContainer.android.kt
M compose/material/material-ripple/src/commonMain/kotlin/androidx/compose/material/ripple/CommonRipple.kt
M compose/material/material-ripple/src/commonMain/kotlin/androidx/compose/material/ripple/Ripple.kt
M compose/material/material-ripple/src/commonMain/kotlin/androidx/compose/material/ripple/RippleAnimation.kt
M compose/material/material-ripple/src/commonMain/kotlin/androidx/compose/material/ripple/RippleTheme.kt
M compose/material/material-ripple/src/desktopMain/kotlin/androidx/compose/material/ripple/Ripple.desktop.kt
ap...@google.com <ap...@google.com> #7
Branch: androidx-main
commit ea6ca60a790f13505fa6a865ecb0f1ee1258876e
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Nov 22 18:15:49 2023
Adds RippleConfiguration APIs to material
RippleConfiguration and LocalRippleConfiguration allow for per-component / sub-tree customization of ripples using fixed values. For example, to change the color of a component you don't control, or to disable a ripple for a component. In most cases the default values should be used: these APIs are an escape hatch for customization of individual components / limited sub-trees. For wider changes and custom design systems, you should instead build your own ripple using createRippleModifierNode.
This CL also migrates the last usages of rememberRipple / RippleTheme to the new APIs.
Bug:
Test: RippleTest
Relnote: "Adds RippleConfiguration and LocalRippleConfiguration to allow for per-component / sub-tree customization of ripples using fixed values. For example, to change the color of a component you don't control, or to disable a ripple for a component. In most cases the default values should be used: these APIs are an escape hatch for customization of individual components / limited sub-trees. For wider changes and custom design systems, you should instead build your own ripple using createRippleModifierNode. For more information, see
Change-Id: I6de11214b76060c93617b0188fc57172d5d5423e
M camera/integration-tests/avsynctestapp/build.gradle
M camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/ui/widget/Button.kt
M camera/integration-tests/uiwidgetstestapp/build.gradle
M camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/TabRow.kt
M camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/imagecapture/ImageCaptureScreenState.kt
M camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/videocapture/VideoCaptureScreenState.kt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/IndicationSamples.kt
M compose/material/material/api/current.txt
M compose/material/material/api/restricted_current.txt
M compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/RippleTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Ripple.kt
M compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/RippleTestActivity.kt
ap...@google.com <ap...@google.com> #8
Branch: androidx-main
commit af92b215fa235f565a4b2e2612f195d67adf9a99
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Nov 22 16:10:31 2023
Adds ripple API to wear material and material3 libraries
The new ripple API replaces the deprecated rememberRipple API - it creates a ripple instance that will use the default theme values. ripple
does not need to be remembered, similar to modifiers - if the parameters compare equally, then the same node can be reused internally.
This CL also migrates all wear:compose-material / wear:compose-material3 components to use the new ripple. There is a temporary
CompositionLocal, LocalUseFallbackRippleImplementation, which can be set to true to fallback to using the old RippleTheme / rememberRipple
implementation, but this is strongly discouraged as it is much less performant than the new implementation. This fallback will be removed in
the next stable release, and exists here to aid migration.
Bug:
Bug:
Test: RippleTest
Relnote: "Adds new ripple API in wear:compose-material and wear:compose-material3 libraries which replaces the deprecated rememberRipple. Also
adds a temporary CompositionLocal, LocalUseFallbackRippleImplementation, to revert Material components to using the deprecated rememberRipple
/ RippleTheme APIs. This will be removed in the next stable release, and is only intended to be a temporary migration aid for cases where you
are providing a custom RippleTheme. See
Change-Id: I87fd7d3968ec14c3e684039298b31a1fc620b47c
M wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/ButtonTest.kt
M wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/ChipTest.kt
M wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/SelectionControlsTest.kt
M wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/StepperTest.kt
M wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/ToggleButtonTest.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Button.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Card.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Chip.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/SelectionControls.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Stepper.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/ToggleButton.kt
M wear/compose/compose-material/api/current.txt
M wear/compose/compose-material/api/restricted_current.txt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Button.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Card.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Chip.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/MaterialTheme.kt
A wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Ripple.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Stepper.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/SwipeToReveal.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ToggleButton.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ToggleChip.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ToggleControl.kt
M wear/compose/compose-material3/api/current.txt
M wear/compose/compose-material3/api/restricted_current.txt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Button.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Card.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/IconButton.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/MaterialTheme.kt
A wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Ripple.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/SelectionControls.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Slider.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Stepper.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/TextButton.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ToggleButton.kt
ap...@google.com <ap...@google.com> #9
Branch: androidx-main
commit 0f002d9ff8b439c32611f6a04e72955b6946161a
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Fri Nov 24 13:25:32 2023
Suppresses material3 usages of ripple APIs
These will be migrated once material3 enters alpha again, so this CL temporarily suppresses them to unblock the overall deprecation story.
Bug:
Test: n/a
Change-Id: I5e72718106c6b633678ad4163c89612288b231d2
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/MaterialRippleThemeTest.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Checkbox.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/IconButton.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MaterialTheme.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationRail.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/RadioButton.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Surface.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Switch.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Tab.kt
ap...@google.com <ap...@google.com> #10
Branch: androidx-main
commit 0d48497ad6b4aba34799b681e6ec565919e9e640
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Fri Nov 24 12:59:00 2023
Adds ripple API to material library
The new ripple API replaces the deprecated rememberRipple API - it creates a ripple instance that will use the default theme values. ripple
does not need to be remembered, similar to modifiers - if the parameters compare equally, then the same node can be reused internally. Also
adds RippleDefaults that contain the default values used by material.
This CL also migrates all material components to use the new ripple. There is a temporary CompositionLocal,
LocalUseFallbackRippleImplementation, which can be set to true to fallback to using the old RippleTheme / rememberRipple implementation, but
this is strongly discouraged as it is much less performant than the new implementation. This fallback will be removed in the next stable
release, and exists here to aid migration.
Bug:
Bug:
Test: RippleTest
Relnote: "Adds new ripple API in material which replaces the deprecated rememberRipple. Also adds a temporary CompositionLocal, LocalUseFallbackRippleImplementation, to revert Material components to using the deprecated rememberRipple / RippleTheme APIs. This will be removed in the next stable release, and is only intended to be a temporary migration aid for cases where you are providing a custom RippleTheme. See
Change-Id: I31629bf341de9ee401489b608135dcfdeeeb8fb6
M compose/material/material/api/current.txt
M compose/material/material/api/restricted_current.txt
M compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/RippleTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Checkbox.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/IconButton.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/MaterialTheme.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Menu.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/NavigationRail.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/RadioButton.kt
A compose/material/material/src/commonMain/kotlin/androidx/compose/material/Ripple.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Surface.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Switch.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Tab.kt
ap...@google.com <ap...@google.com> #11
Branch: androidx-main
commit 42669acf5918c0d34c648465a64a23282dd3a5f5
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Sep 20 17:28:59 2023
Adds IndicationNodeFactory and deprecates Indication#rememberUpdatedInstance
The existing @Composable factory function on Indication results in a high-cost performance floor: it requires us to use Modifier.composed, and
prevents us from doing any lazy initialization of indication. This cl adds a new IndicationNodeFactory, which behaves similarly to
ModifierNodeElement in terms of responsibilities and semantics, which allows us to handle the stateful requirements of indication nodes by
relying on the existing Modifier node infrastructure, instead of modelling that in a composable function. This should lead to simpler
Indication implementations that have more in common with draw modifiers, as well as improved performance and room for future performance
optimizations in clickable and other components.
This CL suppresses the deprecation on existing Indication implementations, they will be rewritten in a future CL.
Bug:
Test: updateApi
Relnote: "Deprecates Indication#rememberUpdatedInstance, and adds IndicationNodeFactory as a replacement. See
Change-Id: I63537be74c7090aec9895764c13bfdfb9e806a93
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/IndicationTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Indication.kt
M compose/material/material-ripple/benchmark/src/androidTest/java/androidx/compose/material/ripple/benchmark/RippleBenchmark.kt
M compose/material/material-ripple/src/commonMain/kotlin/androidx/compose/material/ripple/Ripple.kt
M compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/ModifiersBenchmark.kt
ap...@google.com <ap...@google.com> #12
Branch: androidx-main
commit 1097aa74463157195258e7fb2c590e1e8dcf2edc
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Tue Dec 12 18:49:36 2023
Supports lazily creating indication in clickable
This CL adds a new parameter to clickable and combinedClickable, lazilyCreateIndication, and changes the interactionSource parameter type to be nullable. When lazilyCreateIndication is `true` (by default if interactionSource is null, and indication is an IndicationNodeFactory), an internal MutableInteractionSource will be lazily created along with the indication instance, delaying work until there is an incoming Interaction. This reduces the amount of work that needs to be done during composition - if the clickable never produces an interaction (it is never focused / hovered / pressed), then the indication instance never needs to be created.
For components that observe the provided InteractionSource, but never emit events, they can explicitly pass `true` to lazilyCreateIndication to opt in to the same behavior.
To take advantage of this change, higher level components should change from remembering a default InteractionSource to defaulting to null in their API signature. Components that explicitly observe a hoisted InteractionSource should consider providing `true` to lazilyCreateIndication if the InteractionSource is a) created internally by the component b) only observed, and never emitted to.
Bug:
Fixes:
Test: ClickableTest
Relnote: "Clickable and combinedClickable's interactionSource parameter has been made nullable, and a new parameter has been added: lazilyCreateIndication. When lazilyCreateIndication is `true` (by default if interactionSource is null, and indication is an IndicationNodeFactory), an internal MutableInteractionSource will be lazily created along with the indication instance, delaying work until there is an incoming Interaction. To take advantage of this change, it is recommended that you:
1. Migrate away from the deprecated Indication#rememberUpdatedInstance API if you haven't already, as this optimization is only possible for IndicationNodeFactory implementations
2. Explicitly pass indication to clickable and pass null for interactionSource if you aren't observing it yourself. If you are observing the interactionSource, but you are never emitting an Interaction, you can explicitly set `true` for lazilyCreateIndication.
3. Prefer the clickable overload with a required MutableInteractionSource and Indication parameter, and explicitly pass LocalIndication.current if you are calling this modifier only within composition, as this is more performant than the other clickable overload which needs to use Modifier.composed to retrieve LocalIndication."
Change-Id: Ie0699791a5e3014ff551624cfd001958e6b43e84
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/ClickableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/CombinedClickableTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Clickable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Hoverable.kt
M compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/ModifiersBenchmark.kt
ap...@google.com <ap...@google.com> #13
Branch: androidx-main
commit d99ad62e925dfa9486844f018f8cf36f96e13483
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Thu Dec 14 16:04:07 2023
Supports lazily creating indication in toggleable and selectable
Bug:
Test: SelectableTest
Test: ToggleableTest
Relnote: "selectable, toggleable, and triStateToggleable now have a nullable interactionSource parameter and a lazilyCreateIndication parameter, following the same changes to clickable. For more information see the release notes for the clickable change."
Change-Id: I452665ce7a2152d2bbb971db1df7d658b3a2e86e
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/ClickableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/selection/SelectableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/selection/ToggleableTest.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
lp...@google.com <lp...@google.com> #14
Discussed the status of this work with Matvei, and the CL to change components to have a nullable MutableInteractionSource parameter (aosp/2881586)
We added lazilyCreateIndication as a parameter for two reasons:
- to opt in when you are hoisting the interaction source, but you are only reading it (Button / FAB)
- to opt out if you are not hoisting the interaction, and you need the indication to be created eagerly (such as if your indication is drawing a 'baseline' state before any interactions come in, like a static overlay
In general this parameter is a bit weird, as it controls separate use cases across different components, and it feels a bit like a go fast switch. We decided for now to leave 1 as a known case that is not currently optimized, since it only affects a small subset of components, and I'm not sure if there is even an existing use case for 2 / it isn't something that we explicitly support in the current contract / documentation.
For 2 in the future if a use case arises we can consider adding an experimental flag to IndicationNodeFactory to configure this, but there is the reasonable workaround for now anyway of just explicitly providing a hoisted MutableInteractionSource() to disable the lazy creation anyway.
So I'll remove the parameter, and just change the behavior to be lazily create if interactionSource == null and indication is IndicationNodeFactory.
Then in a followup we'll update components to expose a nullable MutableInteractionSource and update the documentation - the implicit contract that we will make more explicit in the documentation is that this interaction source parameter is an optional 'hoisted' interaction source if you want to own and control / read the interactions externally. Passing null doesn't disable interactions for the component, it just means you do not want to hoist the interactions yourself - so this is still within our component guidelines.
ap...@google.com <ap...@google.com> #15
Branch: androidx-main
commit 645e8b61ea35e1da54d7bbce606a8b573531318c
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Dec 20 17:29:33 2023
Removes lazilyCreateIndication parameter
This parameter conflates behavior changes for different use cases, and is a bit misleading. Indication will continue to be created lazily if a null interaction source is provided, and the indication is of type IndicationNodeFactory. Explicitly hoisting an interaction source will disable the lazily creation. Opting into lazy creation for cases where you are hoisting the interaction source but only reading from it will be considered separately in the future.
Bug:
Test: tests
Relnote: N/A
Change-Id: I795afdf1c49402def71c87c9de57232444ea57c1
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/ClickableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/CombinedClickableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/selection/SelectableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/selection/ToggleableTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Clickable.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
M compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/ModifiersBenchmark.kt
ap...@google.com <ap...@google.com> #16
Branch: androidx-main
commit ef8e9f60d94a9604380d3a00a18425f999fabcda
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Thu Dec 21 15:34:05 2023
Updates Material and Foundation components to expose a nullable MutableInteractionSource
Components that previously exposed an API such as:
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
Have been updated to instead expose a nullable MutableInteractionSource that defaults to null. This allows for some components to never create and remember a MutableInteractionSource, and allows for some other components to lazily create one only when needed. Some components always need a MutableInteractionSource currently, so if null they will just create a new one internally - so for those cases there are no changes, but it allows for future optimizations.
Also deletes long deprecated experimental Card and Surface overloads.
Test: updateApi, existing tests
Bug:
Relnote: "Material and Foundation components exposing a MutableInteractionSource in their API have been updated to now expose a nullable MutableInteractionSource that defaults to null. There are no semantic changes here: passing null means that you do not wish to hoist the MutableInteractionSource, and it will be created inside the component if needed. Changing to null allows for some components to never allocate a MutableInteractionSource, and allows for other components to only lazily create an instance when they need to, which improves performance across these components. If you are not using the MutableInteractionSource you pass to these components, it is recommended that you pass null instead. It is also recommended that you make similar changes in your own components."
Change-Id: I41c73c7809bc704da4ab6b4c2c74016d1380f001
M camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/ui/widget/Button.kt
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/BasicTextField.kt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/Scrollbar.desktop.kt
M compose/material/material/api/current.txt
M compose/material/material/api/restricted_current.txt
M compose/material/material/src/androidMain/kotlin/androidx/compose/material/AndroidMenu.android.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Button.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Card.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Checkbox.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Chip.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/FloatingActionButton.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/IconButton.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Menu.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/NavigationRail.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/OutlinedTextField.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/RadioButton.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Surface.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Switch.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Tab.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextField.kt
M compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DesktopMenu.desktop.kt
ap...@google.com <ap...@google.com> #17
Branch: androidx-main
commit 3f8a328a3d4a7b420d9696126e893b106a4b9cd6
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Dec 27 20:43:56 2023
Updates tv-material components to expose a nullable MutableInteractionSource
Components that previously exposed an API such as:
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
Have been updated to instead expose a nullable MutableInteractionSource that defaults to null. This allows for some components to never create and remember a MutableInteractionSource, and allows for some other components to lazily create one only when needed. Some components always need a MutableInteractionSource currently, so if null they will just create a new one internally - so for those cases there are no changes, but it allows for future optimizations.
Test: updateApi, existing tests
Bug:
Relnote: "tv-material components exposing a MutableInteractionSource in their API have been updated to now expose a nullable MutableInteractionSource that defaults to null. There are no semantic changes here: passing null means that you do not wish to hoist the MutableInteractionSource, and it will be created inside the component if needed. Changing to null allows for some components to never allocate a MutableInteractionSource, and allows for other components to only lazily create an instance when they need to, which improves performance across these components. If you are not using the MutableInteractionSource you pass to these components, it is recommended that you pass null instead. It is also recommended that you make similar changes in your own components."
Change-Id: I309b436d212ef53897979df40da9b1768377893f
M tv/tv-material/api/current.txt
M tv/tv-material/api/restricted_current.txt
M tv/tv-material/src/main/java/androidx/tv/material3/Button.kt
M tv/tv-material/src/main/java/androidx/tv/material3/Card.kt
M tv/tv-material/src/main/java/androidx/tv/material3/CardLayout.kt
M tv/tv-material/src/main/java/androidx/tv/material3/Checkbox.kt
M tv/tv-material/src/main/java/androidx/tv/material3/Chip.kt
M tv/tv-material/src/main/java/androidx/tv/material3/IconButton.kt
M tv/tv-material/src/main/java/androidx/tv/material3/ListItem.kt
M tv/tv-material/src/main/java/androidx/tv/material3/NavigationDrawerItem.kt
M tv/tv-material/src/main/java/androidx/tv/material3/RadioButton.kt
M tv/tv-material/src/main/java/androidx/tv/material3/Surface.kt
M tv/tv-material/src/main/java/androidx/tv/material3/Switch.kt
M tv/tv-material/src/main/java/androidx/tv/material3/Tab.kt
M tv/tv-material/src/main/java/androidx/tv/material3/WideButton.kt
ap...@google.com <ap...@google.com> #18
Branch: androidx-main
commit f8fa920a5a088277028bfa4c186aedb235d253c0
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Dec 27 20:42:07 2023
Updates wear material and wear material3 components to expose a nullable MutableInteractionSource
Components that previously exposed an API such as:
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
Have been updated to instead expose a nullable MutableInteractionSource that defaults to null. This allows for some components to never create and remember a MutableInteractionSource, and allows for some other components to lazily create one only when needed. Some components always need a MutableInteractionSource currently, so if null they will just create a new one internally - so for those cases there are no changes, but it allows for future optimizations.
Test: updateApi, existing tests
Bug:
Relnote: "Wear material and wear material3 components exposing a MutableInteractionSource in their API have been updated to now expose a nullable MutableInteractionSource that defaults to null. There are no semantic changes here: passing null means that you do not wish to hoist the MutableInteractionSource, and it will be created inside the component if needed. Changing to null allows for some components to never allocate a MutableInteractionSource, and allows for other components to only lazily create an instance when they need to, which improves performance across these components. If you are not using the MutableInteractionSource you pass to these components, it is recommended that you pass null instead. It is also recommended that you make similar changes in your own components."
Change-Id: Ib90fc2736d2311e467d7c2a3fef4df757afaf525
M wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/ButtonTest.kt
M wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/SelectionControlsTest.kt
M wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/ToggleButtonTest.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Button.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Card.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/RepeatableClickable.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/SelectionControls.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Slider.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/ToggleButton.kt
M wear/compose/compose-material/api/current.txt
M wear/compose/compose-material/api/restricted_current.txt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Button.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Card.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Chip.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/SwipeToReveal.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ToggleButton.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ToggleChip.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ToggleControl.kt
M wear/compose/compose-material3/api/current.txt
M wear/compose/compose-material3/api/restricted_current.txt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Button.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Card.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/IconButton.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/RadioButton.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/TextButton.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ToggleButton.kt
lp...@google.com <lp...@google.com> #19
ap...@google.com <ap...@google.com> #20
Branch: androidx-main
commit 2e1799e019e275415a95804a8beb5a5a0bf3f86f
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Jan 10 02:53:19 2024
Removes AbstractClickablePointerInputNode, flattens pointer input logic
Pointer input handling is now handled inline: click and hover handling as well as their corresponding interactions are all handled in one place, removing the need for a separate pointer input node for clicks, and removing the HoverableNode delegation.
Bug:
Test: existing tests
Change-Id: I755c468d84f538aef3354a385c81e8c38fa69738
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/selection/SelectableTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Clickable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Hoverable.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
ap...@google.com <ap...@google.com> #21
Branch: androidx-main
commit b657f2f2082e2a1d17c2c259792ac9f3a57d2e0a
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Fri Nov 24 13:28:02 2023
Adds ripple API to material3 library
The new ripple API replaces the deprecated rememberRipple API - it creates a ripple instance that will use the default theme values. ripple does not need to be remembered, similar to modifiers - if the parameters compare equally, then the same node can be reused internally. Also adds RippleDefaults that contain the default values used by material3.
This CL also migrates all material3 components to use the new ripple. There is a temporary CompositionLocal, LocalUseFallbackRippleImplementation, which can be set to true to fallback to using the old RippleTheme / rememberRipple implementation, but this is strongly discouraged as it is much less performant than the new implementation. This fallback will be removed in the next stable release, and exists here to aid migration.
Bug:
Bug:
Test: RippleTest
Relnote: "Adds new ripple API in material3 which replaces the deprecated rememberRipple. Also adds a temporary CompositionLocal, LocalUseFallbackRippleImplementation, to revert material3 components to using the deprecated rememberRipple / RippleTheme APIs. This will be removed in the next stable release, and is only intended to be a temporary migration aid for cases where you are providing a custom RippleTheme. See
Change-Id: I34cbc2834133de4f3e8dde389ed4dab8c54b0c95
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/RippleTest.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Checkbox.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/IconButton.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MaterialTheme.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationRail.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/RadioButton.kt
A compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Ripple.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Surface.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Switch.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Tab.kt
ap...@google.com <ap...@google.com> #22
Branch: androidx-main
commit c1dfd3a4e8af6f3b9182211f39883962ee81385b
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Fri Nov 24 13:30:18 2023
Adds RippleConfiguration APIs to material3
RippleConfiguration and LocalRippleConfiguration allow for per-component / sub-tree customization of ripples using fixed values. For example, to change the color of a component you don't control, or to disable a ripple for a component. In most cases the default values should be used: these APIs are an escape hatch for customization of individual components / limited sub-trees. For wider changes and custom design systems, you should instead build your own ripple using createRippleModifierNode.
Bug:
Test: RippleTest
Relnote: "Adds RippleConfiguration and LocalRippleConfiguration to allow for per-component / sub-tree customization of ripples using fixed values. For example, to change the color of a component you don't control, or to disable a ripple for a component. In most cases the default values should be used: these APIs are an escape hatch for customization of individual components / limited sub-trees. For wider changes and custom design systems, you should instead build your own ripple using createRippleModifierNode. For more information, see
Change-Id: I7b5d62fd50ee78bb3559f83886aa1e7d9f964fb1
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/RippleTest.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Ripple.kt
ap...@google.com <ap...@google.com> #23
Branch: androidx-main
commit 6b42889368193eccb3bb2b1af1850f0a2a76feca
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Thu Dec 28 04:08:41 2023
Updates material3 components to expose a nullable MutableInteractionSource
Components that previously exposed an API such as:
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
Have been updated to instead expose a nullable MutableInteractionSource that defaults to null. This allows for some components to never create and remember a MutableInteractionSource, and allows for some other components to lazily create one only when needed. Some components always need a MutableInteractionSource currently, so if null they will just create a new one internally - so for those cases there are no changes, but it allows for future optimizations.
Test: updateApi, existing tests
Bug:
Relnote: "Material3 components exposing a MutableInteractionSource in their API have been updated to now expose a nullable MutableInteractionSource that defaults to null. There are no semantic changes here: passing null means that you do not wish to hoist the MutableInteractionSource, and it will be created inside the component if needed. Changing to null allows for some components to never allocate a MutableInteractionSource, and allows for other components to only lazily create an instance when they need to, which improves performance across these components. If you are not using the MutableInteractionSource you pass to these components, it is recommended that you pass null instead. It is also recommended that you make similar changes in your own components."
Change-Id: I41abb601499b4a735b6302b96cdc1f0d066dbbdc
M compose/material3/material3-adaptive-navigation-suite/api/current.txt
M compose/material3/material3-adaptive-navigation-suite/api/restricted_current.txt
M compose/material3/material3-adaptive-navigation-suite/src/commonMain/kotlin/androidx/compose/material3/adaptive/navigation-suite/NavigationSuiteScaffold.kt
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/AndroidMenu.android.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SearchBar.android.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Button.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Card.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Checkbox.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Chip.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/FloatingActionButton.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/IconButton.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Label.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationRail.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/OutlinedTextField.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/RadioButton.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SegmentedButton.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Surface.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Switch.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Tab.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextField.kt
ap...@google.com <ap...@google.com> #24
Branch: androidx-main
commit 176632f8e826524658d782b03c9d27892d047819
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Jan 31 15:59:06 2024
Turns off auto invalidation in clickable / focusable
This causes a lot of extra work when input parameters are changed, such as invalidating focus nodes - even though most of these parameters do not affect the state of the node tree.
Bug:
Fixes:
Test: ClickableTest
Test: TabRowBenchmark
Change-Id: I2fcc8732784d27fde072ac739f917f6da5a432a6
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/ClickableTest.kt
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/FocusedBounds.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewRequester.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponder.kt
lp...@google.com <lp...@google.com> #25
Summarizing a discussion we had today: One of the long term ideas / goals we had for clickable was to be able to fully remove focus* logic, when in touch mode. There are some problems with this approach:
a) When we are in touch mode, and we swap to non-touch mode with a key press, this will also request focus. This means that in order for us to handle this properly, we need to have a stable focus tree by this point in time: if we just observeReads and delegate() a focus node, this will happen after we apply changes, so the nodes won't be attached when we try and focus. Instead we would probably need to advance the snapshot, to force synchronous creation of the focus node tree, but focus invalidation currently happens after we apply changes, so if we immediately add the nodes the focus tree will be in a broken state, so this would require some unknown amount of rewriting to make sure we can initialize the tree inline, safely, to make this use case work.
b) behavior gets a bit dangerous / undefined if we do this, consider the following:
Button(Modifier.focusProperties { ... }...)
Depending on touch mode, this focus properties modifier would either apply to the focus target inside button, or the next focus target within - this is very misleading and can lead to subtle behavioral problems. It's also hard to define this 'correctly', if you only want to affect the button in non-touch mode: for the reasons listed in a) it would be difficult to synchronize the creation of this focus properties modifier, with the time we create the focus target, to make sure that everything is in sync at the same time.
We might want to revisit this in the future, but given the constraints / unknown work here, and the performance investigations we did, it looks like we can still get close to this performance baseline with some other optimizations, so focusing on making sure that when we aren't focusable, as little work is done as possible inside focus.
ap...@google.com <ap...@google.com> #26
Branch: androidx-main
commit a3b31c9837990f5d556aeda56c056d464848af3a
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Tue Apr 09 01:59:53 2024
Adds APIs to FocusTargetModifierNode for observing focus changes, configuring focusability, and requesting focus
This allows delegating nodes to just delegate to one FocusTargetModifierNode, instead of needing to add separate requester / event / properties nodes to modify the delegated and owned target node.
Also migrates focusable / clickable to use this, which reduces the cost of focus invalidation as we can remove all the other node types.
FocusProperties APIs for configurating focus requesters will be added in the future to FocusTargetModifierNode.
Bug:
Test: FocusableTest
Test: ClickableTest
Test: FocusTargetModifierNodeTest
Relnote: "Added FocusTargetModifierNode#requestFocus(), FocusTargetModifierNode#focusability, and a new FocusTargetModifierNode() overload that exposes FocusTargetMode and a callback for when focus state changes. This makes it simpler to implement delegated modifiers that should be focusable, as you do not need to implement requester / event / properties nodes as well, in order to modify the target node."
Change-Id: I27f84d34307dc78bbd14ecda328ea9cdc5b63b8b
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/FocusableTest.kt
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/ui/ui/api/current.ignore
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/restricted_current.ignore
M compose/ui/ui/api/restricted_current.txt
A compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/focus/FocusTargetModifierNodeTest.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/node/NodeUtils.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusEventModifierNode.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusInvalidationManager.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwnerImpl.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusTargetModifierNode.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusTargetNode.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusTransactions.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/Focusability.kt
lp...@google.com <lp...@google.com> #27
After the last CL, there are no more high priority areas of work related to / inside clickable itself that we are tracking for performance - clickable is roughly 4x in perf microbenchmarks since 1.5*. There is ongoing work into optimizing parts of the focus system, but that's at a lower level than clickable and won't affect clickable's implementation. Closing this bug accordingly
Description
multiple state objects, multiple GlobalPositionAwareNodes which invalidate layout every time this updates, and many allocations and initialization work.
We can expect there to be dozens of clickables on a relatively average screen, and much more in some situations, so it being cheap is incredibly important. Moreover, most of them will never get interacted with, and we ought to pay as little for those as possible during initialization.
In the CL linked below, I have laid out my ideas for how I think we should refactor Clickable. Broadly this amounts to:
1. refactor indication to not need composition
2. make clickable correspond to a single element / node, even including delegated nodes, until there is an interaction that warrants an "inflation" of the node to include the more expensive things like indication etc.
More context on this issue can be found in aosp/2729638