Fixed
Status Update
Comments
an...@google.com <an...@google.com>
nj...@google.com <nj...@google.com> #2
Pushed up a fix here:
This addresses
Thoughts?
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 58b99f068004fee3861dfcce7b09d33c5fe4a891
Author: Nader Jawad <njawad@google.com>
Date: Fri Jul 16 15:36:08 2021
Make Modifier.paint behave like Modifier.drawBehind
Relnote: "In order to better support chaining of
draw modifiers, make sure the Modifier.paint implementation
calls drawsContent.
Previously Modifier.paint was expected to a leaf node in
the chain of Modifiers, however, by doing so it prevents
it from being configured on a composable container (ex. box)
or adding additional decorations on top such as
Modifier.paint().border(). By having Modifier.paint
call drawContent after drawing the contents of the given
painter, we have better behavior consistency in behavior
with the modifier pattern."
Fixes: 178201337
Fixes: 186213275
Test: Added test to PainterModifierTest
Change-Id: Ibb2a7ae54a86643ba4fc1604ce39df7477ab66f0
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/PainterModifierTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/PainterModifier.kt
https://android-review.googlesource.com/1770022
Branch: androidx-main
commit 58b99f068004fee3861dfcce7b09d33c5fe4a891
Author: Nader Jawad <njawad@google.com>
Date: Fri Jul 16 15:36:08 2021
Make Modifier.paint behave like Modifier.drawBehind
Relnote: "In order to better support chaining of
draw modifiers, make sure the Modifier.paint implementation
calls drawsContent.
Previously Modifier.paint was expected to a leaf node in
the chain of Modifiers, however, by doing so it prevents
it from being configured on a composable container (ex. box)
or adding additional decorations on top such as
Modifier.paint().border(). By having Modifier.paint
call drawContent after drawing the contents of the given
painter, we have better behavior consistency in behavior
with the modifier pattern."
Fixes: 178201337
Fixes: 186213275
Test: Added test to PainterModifierTest
Change-Id: Ibb2a7ae54a86643ba4fc1604ce39df7477ab66f0
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/PainterModifierTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/PainterModifier.kt
Description
Jetpack Compose release version: 1.0.0-beta05
Android Studio Arctic Fox | 2020.3.1 Canary 14 Build #AI-203.7717.56.2031.7260174, built on April 6, 2021 Runtime version: 11.0.9.1+0-b77-7246554 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 10.16 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 12 Registry: external.system.auto.import.disabled=true
Talking with malkov@ we have a situation where we want to be able to use a painter to paint the background of a composable. Modifier.paint(Painter) doesn't work as we would like as it will not paint content. He suggested I raise a bug to get a new background modifier added that would take a painter directly.
To work around this issue I have ended up stacking a pair of boxes with the box at the back being Modifier.paint(painter) and the front one having the content.