Fixed
Status Update
Comments
cl...@google.com <cl...@google.com>
ma...@google.com <ma...@google.com> #2
Project: platform/frameworks/support
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
https://android-review.googlesource.com/2649119
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
ap...@google.com <ap...@google.com> #3
PointF was the main (possibly only) mutability issue, marking this as fixed
ap...@google.com <ap...@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
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit e4894d0b99ea6360cc84bc2bc55d6f602e3b8b63
Author: Calin Tataru <calintat@google.com>
Date: Mon Jul 27 10:53:31 2020
Refactor stateDraggable and rename to swipeable
This CL does the following things:
* Rename Modifier.stateDraggable to Modifier.swipeable.
* Make swipeable public and mark it as ExperimentalMaterialApi.
* Introduce the concept of SwipeableState which holds the current state
of the swipeable as well as the animated float, and provides methods for
updating the state and subscribing to more granular in-movement updates.
* Rename DrawerState to DrawerValue, and introduce a new DrawerState
class which is a subclass of SwipeableState<DrawerValue> and provides
more contextual methods such as isOpen or open(). Same for BottomDrawer.
Bug: 148023068
Test: Ran DrawerTest, ScaffoldTest and SwitchTest
Relnote: "Modifier.stateDraggable was completely reworked and renamed
to Modifier.swipeable. A new SwipeableState class was introduced, and
DrawerState and BottomDrawerState were refactored to inherit from it.
[Modal/Bottom]DrawerLayout no longer take an onStateChange parameter."
Change-Id: I7233229dfc9c04a4615f4c1cc29e604b97edd1df
M compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/HotReloadIntegrationTests.kt
M ui/ui-material/api/current.txt
M ui/ui-material/api/public_plus_experimental_current.txt
M ui/ui-material/api/restricted_current.txt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/DrawerSamples.kt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/ScaffoldSamples.kt
A ui/ui-material/samples/src/main/java/androidx/compose/material/samples/SwipeableSamples.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerScreenshotTest.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldTest.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Scaffold.kt
A ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Switch.kt
D ui/ui-material/src/commonMain/kotlin/androidx/compose/material/internal/StateDraggable.kt
https://android-review.googlesource.com/1362598
Branch: androidx-master-dev
commit e4894d0b99ea6360cc84bc2bc55d6f602e3b8b63
Author: Calin Tataru <calintat@google.com>
Date: Mon Jul 27 10:53:31 2020
Refactor stateDraggable and rename to swipeable
This CL does the following things:
* Rename Modifier.stateDraggable to Modifier.swipeable.
* Make swipeable public and mark it as ExperimentalMaterialApi.
* Introduce the concept of SwipeableState which holds the current state
of the swipeable as well as the animated float, and provides methods for
updating the state and subscribing to more granular in-movement updates.
* Rename DrawerState to DrawerValue, and introduce a new DrawerState
class which is a subclass of SwipeableState<DrawerValue> and provides
more contextual methods such as isOpen or open(). Same for BottomDrawer.
Bug: 148023068
Test: Ran DrawerTest, ScaffoldTest and SwitchTest
Relnote: "Modifier.stateDraggable was completely reworked and renamed
to Modifier.swipeable. A new SwipeableState class was introduced, and
DrawerState and BottomDrawerState were refactored to inherit from it.
[Modal/Bottom]DrawerLayout no longer take an onStateChange parameter."
Change-Id: I7233229dfc9c04a4615f4c1cc29e604b97edd1df
M compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/HotReloadIntegrationTests.kt
M ui/ui-material/api/current.txt
M ui/ui-material/api/public_plus_experimental_current.txt
M ui/ui-material/api/restricted_current.txt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/DrawerSamples.kt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/ScaffoldSamples.kt
A ui/ui-material/samples/src/main/java/androidx/compose/material/samples/SwipeableSamples.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerScreenshotTest.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldTest.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Scaffold.kt
A ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Switch.kt
D ui/ui-material/src/commonMain/kotlin/androidx/compose/material/internal/StateDraggable.kt
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-master-dev
commit e4894d0b99ea6360cc84bc2bc55d6f602e3b8b63
Author: Calin Tataru <calintat@google.com>
Date: Mon Jul 27 10:53:31 2020
Refactor stateDraggable and rename to swipeable
This CL does the following things:
* Rename Modifier.stateDraggable to Modifier.swipeable.
* Make swipeable public and mark it as ExperimentalMaterialApi.
* Introduce the concept of SwipeableState which holds the current state
of the swipeable as well as the animated float, and provides methods for
updating the state and subscribing to more granular in-movement updates.
* Rename DrawerState to DrawerValue, and introduce a new DrawerState
class which is a subclass of SwipeableState<DrawerValue> and provides
more contextual methods such as isOpen or open(). Same for BottomDrawer.
Bug: 148023068
Test: Ran DrawerTest, ScaffoldTest and SwitchTest
Relnote: "Modifier.stateDraggable was completely reworked and renamed
to Modifier.swipeable. A new SwipeableState class was introduced, and
DrawerState and BottomDrawerState were refactored to inherit from it.
[Modal/Bottom]DrawerLayout no longer take an onStateChange parameter."
Change-Id: I7233229dfc9c04a4615f4c1cc29e604b97edd1df
M compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/HotReloadIntegrationTests.kt
M ui/ui-material/api/current.txt
M ui/ui-material/api/public_plus_experimental_current.txt
M ui/ui-material/api/restricted_current.txt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/DrawerSamples.kt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/ScaffoldSamples.kt
A ui/ui-material/samples/src/main/java/androidx/compose/material/samples/SwipeableSamples.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerScreenshotTest.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldTest.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Scaffold.kt
A ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Switch.kt
D ui/ui-material/src/commonMain/kotlin/androidx/compose/material/internal/StateDraggable.kt
https://android-review.googlesource.com/1362598
Branch: androidx-master-dev
commit e4894d0b99ea6360cc84bc2bc55d6f602e3b8b63
Author: Calin Tataru <calintat@google.com>
Date: Mon Jul 27 10:53:31 2020
Refactor stateDraggable and rename to swipeable
This CL does the following things:
* Rename Modifier.stateDraggable to Modifier.swipeable.
* Make swipeable public and mark it as ExperimentalMaterialApi.
* Introduce the concept of SwipeableState which holds the current state
of the swipeable as well as the animated float, and provides methods for
updating the state and subscribing to more granular in-movement updates.
* Rename DrawerState to DrawerValue, and introduce a new DrawerState
class which is a subclass of SwipeableState<DrawerValue> and provides
more contextual methods such as isOpen or open(). Same for BottomDrawer.
Bug: 148023068
Test: Ran DrawerTest, ScaffoldTest and SwitchTest
Relnote: "Modifier.stateDraggable was completely reworked and renamed
to Modifier.swipeable. A new SwipeableState class was introduced, and
DrawerState and BottomDrawerState were refactored to inherit from it.
[Modal/Bottom]DrawerLayout no longer take an onStateChange parameter."
Change-Id: I7233229dfc9c04a4615f4c1cc29e604b97edd1df
M compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/HotReloadIntegrationTests.kt
M ui/ui-material/api/current.txt
M ui/ui-material/api/public_plus_experimental_current.txt
M ui/ui-material/api/restricted_current.txt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/DrawerSamples.kt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/ScaffoldSamples.kt
A ui/ui-material/samples/src/main/java/androidx/compose/material/samples/SwipeableSamples.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerScreenshotTest.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldTest.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Scaffold.kt
A ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Switch.kt
D ui/ui-material/src/commonMain/kotlin/androidx/compose/material/internal/StateDraggable.kt
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-master-dev
commit e4894d0b99ea6360cc84bc2bc55d6f602e3b8b63
Author: Calin Tataru <calintat@google.com>
Date: Mon Jul 27 10:53:31 2020
Refactor stateDraggable and rename to swipeable
This CL does the following things:
* Rename Modifier.stateDraggable to Modifier.swipeable.
* Make swipeable public and mark it as ExperimentalMaterialApi.
* Introduce the concept of SwipeableState which holds the current state
of the swipeable as well as the animated float, and provides methods for
updating the state and subscribing to more granular in-movement updates.
* Rename DrawerState to DrawerValue, and introduce a new DrawerState
class which is a subclass of SwipeableState<DrawerValue> and provides
more contextual methods such as isOpen or open(). Same for BottomDrawer.
Bug: 148023068
Test: Ran DrawerTest, ScaffoldTest and SwitchTest
Relnote: "Modifier.stateDraggable was completely reworked and renamed
to Modifier.swipeable. A new SwipeableState class was introduced, and
DrawerState and BottomDrawerState were refactored to inherit from it.
[Modal/Bottom]DrawerLayout no longer take an onStateChange parameter."
Change-Id: I7233229dfc9c04a4615f4c1cc29e604b97edd1df
M compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/HotReloadIntegrationTests.kt
M ui/ui-material/api/current.txt
M ui/ui-material/api/public_plus_experimental_current.txt
M ui/ui-material/api/restricted_current.txt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/DrawerSamples.kt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/ScaffoldSamples.kt
A ui/ui-material/samples/src/main/java/androidx/compose/material/samples/SwipeableSamples.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerScreenshotTest.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldTest.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Scaffold.kt
A ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Switch.kt
D ui/ui-material/src/commonMain/kotlin/androidx/compose/material/internal/StateDraggable.kt
https://android-review.googlesource.com/1362598
Branch: androidx-master-dev
commit e4894d0b99ea6360cc84bc2bc55d6f602e3b8b63
Author: Calin Tataru <calintat@google.com>
Date: Mon Jul 27 10:53:31 2020
Refactor stateDraggable and rename to swipeable
This CL does the following things:
* Rename Modifier.stateDraggable to Modifier.swipeable.
* Make swipeable public and mark it as ExperimentalMaterialApi.
* Introduce the concept of SwipeableState which holds the current state
of the swipeable as well as the animated float, and provides methods for
updating the state and subscribing to more granular in-movement updates.
* Rename DrawerState to DrawerValue, and introduce a new DrawerState
class which is a subclass of SwipeableState<DrawerValue> and provides
more contextual methods such as isOpen or open(). Same for BottomDrawer.
Bug: 148023068
Test: Ran DrawerTest, ScaffoldTest and SwitchTest
Relnote: "Modifier.stateDraggable was completely reworked and renamed
to Modifier.swipeable. A new SwipeableState class was introduced, and
DrawerState and BottomDrawerState were refactored to inherit from it.
[Modal/Bottom]DrawerLayout no longer take an onStateChange parameter."
Change-Id: I7233229dfc9c04a4615f4c1cc29e604b97edd1df
M compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/HotReloadIntegrationTests.kt
M ui/ui-material/api/current.txt
M ui/ui-material/api/public_plus_experimental_current.txt
M ui/ui-material/api/restricted_current.txt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/DrawerSamples.kt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/ScaffoldSamples.kt
A ui/ui-material/samples/src/main/java/androidx/compose/material/samples/SwipeableSamples.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerScreenshotTest.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldTest.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Scaffold.kt
A ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Switch.kt
D ui/ui-material/src/commonMain/kotlin/androidx/compose/material/internal/StateDraggable.kt
Description
Motivation: This is key to create rich transitions and be able to update content based on what's going to happen. For example, imagine that you have a Draggable composable whose content must be shown/hidden at a threshold.
E.g. You might have something like this as a state:
enum class HomeState {
HomeBottomBarCollapsed,
HomeBottomBarContentReveal,
HomeBottomBaExpanded
}
I'd be nice to know that the current state is HomeBottomBarContentReveal but is moving towards HomeBottomBaExpanded so that I can show the content. Otherwise, if the movement is the opposite, then hide it.