Status Update
Comments
ma...@google.com <ma...@google.com>
so...@google.com <so...@google.com> #2
Branch: androidx-main
commit a330c0d3bcdd41326f37968a60e6084ad4a2e32c
Author: Chet Haase <chet@google.com>
Date: Wed Jul 05 07:26:46 2023
Convert APIs using PointF to use Float instead
PointF is a convenient mechanism for passing around x.y values
representing 2D points. But there are downsides, including:
- Converting to PointF: You may not have the data in PointF form
to begin with, so using an API which takes PointF requires converting
the data to that form (including allocating a PointF object every time)
- Mutability: Point structures can be mutated internally, causing
unpredictability in what that mutation means. Should the library
react to those changes? Ignore them? Do defensive copies (requiring
even more allocations)? Using primitive types like Float make the
behavior more obvious (by making the data inherently immutable).
- Allocations: Whenever we use object types, there are necessarily
allocations on the Java heap for them. This puts pressure on the GC
at both allocation and collection time. Given the amount of points
being passed around (especially at morph creation time, when curves
are being split and created), this causes a lot of PointF objects to
be allocated (even temporarily). Using Float avoids that problem.
Also fixed bug with unclosed paths causing discontinuity at the
start/end point.
Bug: 276466399
Bug: 290254314
Test: integration and unit tests pass
Relnote: PointF parameters changed to Float pairs
Change-Id: Id4705d27c7be31b26ade8186b99fffe2e2f8450e
M graphics/graphics-shapes/api/current.txt
M graphics/graphics-shapes/api/restricted_current.txt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CubicShapeTest.kt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CubicTest.kt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/PolygonMeasureTest.kt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/PolygonTest.kt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/RoundedPolygonTest.kt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/ShapesTest.kt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/TestUtils.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Cubic.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/CubicShape.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/FeatureMapping.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/FloatMapping.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Morph.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/PolygonMeasure.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/RoundedPolygon.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Shapes.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Utils.kt
M graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/DebugDraw.kt
M graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/ShapeEditor.kt
M graphics/integration-tests/testapp/src/main/java/androidx/graphics/shapes/test/MaterialShapes.kt
ez...@gmail.com <ez...@gmail.com> #3
so...@google.com <so...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.graphics:graphics-shapes:1.0.0-alpha04
ch...@google.com <ch...@google.com> #5
The reason we are seeing this is because calling Popup
, through its use of setContent
on the corresponding popup view, will call ProvideCommonAmbients
again. This means, from composition perspective it looks like,
ProvideCommonAmbients {
...
Provide(MyAmbient provides 10) {
...
ProvideCommonAmbients {
...
MyAmbient.current
}
}
}
The mental model is that ambients look up the composition for the first provider it finds of the MyAmbient
(we actually build the scope as we go but the model holds). If MyAmbient
is provided in ProvideCommonAmbients
as 200
you can see that MyAmbient.current
will provide 200
which is what Filip demonstrated above.
The solution for this is to not reprovide ambient values inProvideCustomAmbients
, such as MyAmbient
or RTL, that are expected to inherit across nested view or portaled content (such as what Popup
does). One solution is to make ProvideCommonAmbients
more complicated by looking up all the providers but I believe a better solution would be to add providesDefault
as a peer of provides
to create a provider that only has an effect if the value is not already provided by the parent. Then ProvideCommonAmbients
would be changed to use providesDefault
instead of the unconditional provides
.
Right now, given my current priorities, I would not be able to implement this soon. However I would be more than happy to help someone who is willing to take this on.
I am assigning to Clara for now until it is decided who should work on this.
po...@google.com <po...@google.com>
ap...@google.com <ap...@google.com> #6
Branch: androidx-master-dev
commit a3ff42b57f75f0cadca18ab65774dd22c9628238
Author: Mihai Popa <popam@google.com>
Date: Thu Oct 29 14:53:57 2020
Add provideDefault for ambient and use it for LD
Relnote: provideDefault was added as an alternative to provide for providing ambients, and it can be used to specify ambient values that will only be set when there is no ambient value already provided.
Fixes: 171024925
Test: PopupTest
Change-Id: Id663500276ad2ec3e5a5b1310a81efbf3acc0842
M compose/runtime/runtime/api/current.txt
M compose/runtime/runtime/api/public_plus_experimental_current.txt
M compose/runtime/runtime/api/restricted_current.txt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Ambient.kt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Ambients.kt
Description
Build: AI-202.7319.50.42.6863838, 202009251539,
AI-202.7319.50.42.6863838, JRE 11.0.8+10-b944.6842174x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1920x1080, 1920x1080
AS: 4.2 Canary 13; Kotlin plugin: 1.4.10-release-Studio4.2-1; Android Gradle Plugin: 4.2.0-alpha13; Gradle: 6.7; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)
IMPORTANT: Please readhttps://developer.android.com/studio/report-bugs.html carefully and supply all required information.
Compose Version : 1.0.0-alpha05
I'm building an app that's all RTL. I have an Alert Dialog in it, but the text inside the dialog isn't following RTL. I tried changing the alignment of the text, wrapping the Alert Dialog inside an RTL provider, wrapping the text inside an RTL provider, but nothing works.
Is something wrong with the component? Or is tehre something I'm not doing?