Fixed
Status Update
Comments
lp...@google.com <lp...@google.com> #2
Nader, do you have plans to pick this up again? Feel free to reassign to me if you have no time, I can land this.
nj...@google.com <nj...@google.com> #3
That would be great if you have some spare cycles. Thank you Louis!
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
Author: Louis Pullen-Freilich <
Link:
Adds DelegatableNode callbacks for onDensityChange and onLayoutDirectionChange
Expand for full commit details
Adds DelegatableNode callbacks for onDensityChange and onLayoutDirectionChange
Updates existing modifiers to use these where possible
Fixes: b/340662451
Test: existing tests
Relnote: "Adds DelegatableNode#onDensityChange and DelegatableNode#onLayoutDirectionChange callbacks to allow updating node state when these change"
Change-Id: I04f3e3afea5aabdc6225b1afb197df18133eb018
Files:
- M
compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ScrollingContainer.kt
- M
compose/ui/ui/api/current.txt
- M
compose/ui/ui/api/restricted_current.txt
- M
compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/DrawModifier.kt
- M
compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/DelegatableNode.kt
- M
compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNode.kt
- M
compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/PointerInputModifierNode.kt
Hash: 952f4aa674af0691d465783dc9f5637ad72d527e
Date: Wed Oct 09 16:50:20 2024
na...@google.com <na...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.foundation:foundation:1.8.0-alpha04
androidx.compose.foundation:foundation-android:1.8.0-alpha04
androidx.compose.foundation:foundation-jvmstubs:1.8.0-alpha04
androidx.compose.ui:ui:1.8.0-alpha04
androidx.compose.ui:ui-android:1.8.0-alpha04
androidx.compose.ui:ui-jvmstubs:1.8.0-alpha04
androidx.compose.ui:ui-linuxx64stubs:1.8.0-alpha04
Description
See: b/336270922
Currently Modifier.drawWithCache queries the current density and layout direction from
DelegatableNode#requireDensity
andDelegatableNode#requireLayoutDirection
. However, LayoutNode currently does not broadcast changes back to the modifier chain whenever the density or layout direction change. That leads to issues where Modifier.drawWithCache does not update based on the latest density/layout direction that was available.There is already prior art that special cases PointerInput modifiers to receive updates to density/layoutdirection changes and the fix for b/336270922 does the same for Modifier.drawWithCache. This is because at the time b/336270922 was addressed, API changes to add APIs to DelegatableNode are disallowed. So introduce a stopgap solution to fix the bug now and introduce a more holistic solution going forward.
Discussions with the wider team in the Modifier task force group lead to consensus that introducinghttps://chat.google.com/room/AAAAbSAVMlo/m_-HpV0vl1o
DelegateableNode#onLayoutDirectionChanged
andDelegatabelNode#onDensityChanged
would be a preferable longer term solution. See: