Fixed
Status Update
Comments
ma...@gmail.com <ma...@gmail.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
ma...@gmail.com <ma...@gmail.com> #3
PointF was the main (possibly only) mutability issue, marking this as fixed
ma...@google.com <ma...@google.com>
ke...@google.com <ke...@google.com>
ki...@gmail.com <ki...@gmail.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
co...@google.com <co...@google.com>
ki...@gmail.com <ki...@gmail.com> #7
[versions]
agp = "8.2.2"
coil-compose = "2.5.0"
compose-shimmer = "1.2.0"
sealedx-processor = "1.0.2"
sealedx-core = "1.0.2"
vico = "2.0.0-alpha.6"
github-core = "1.9.62"
github-glassmorphic-composables = "0.0.7"
github-sandwich = "2.0.5"
gson = "2.10.1"
haze-jetpack-compose = "0.4.5"
hilt-android = "2.46"
hilt-navigation-compose = "1.1.0"
kotlin = "1.9.22"
core-ktx = "1.12.0"
junit = "4.13.2"
androidx-test-ext-junit = "1.1.5"
espresso-core = "3.5.1"
ksp = "1.9.62"
lifecycle-runtime-ktx = "2.7.0"
activity-compose = "1.8.2"
compose-bom = "2023.10.01"
moshi = "1.15.0"
moshi-kotlin-codegen = "1.15.0"
retrofit = "2.9.0"
room-runtime = "2.6.1"
stories = "1.0.2"
[libraries]
androidx-hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hilt-navigation-compose" }
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room-runtime" }
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room-runtime" }
coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil-compose" }
compose-shimmer = { module = "com.valentinilk.shimmer:compose-shimmer", version.ref = "compose-shimmer" }
converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" }
destinationCore = { module = "io.github.raamcosta.compose-destinations:core", version.ref = "github-core" }
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" }
haze-jetpack-compose = { module = "dev.chrisbanes.haze:haze-jetpack-compose", version.ref = "haze-jetpack-compose" }
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt-android" }
hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt-android" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-ext-junit" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso-core" }
destinationKsp = { module = "io.github.raamcosta.compose-destinations:ksp", version.ref = "ksp" }
lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle-runtime-ktx" }
activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity-compose" }
compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" }
moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshi" }
moshi-kotlin-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi-kotlin-codegen" }
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
sandwich-retrofit = { module = "com.github.skydoves:sandwich-retrofit", version.ref = "github-sandwich" }
sealedx-processor = { module = "com.github.skydoves:sealedx-processor", version.ref = "sealedx-processor" }
sealedx-core = { module = "com.github.skydoves:sealedx-core", version.ref = "sealedx-core" }
skydoves-sandwich = { module = "com.github.skydoves:sandwich", version.ref = "github-sandwich" }
stories = { module = "com.github.raipankaj:Stories", version.ref = "stories" }
ui = { group = "androidx.compose.ui", name = "ui" }
ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
material3 = { group = "androidx.compose.material3", name = "material3", version = "1.2.0-rc01" }
vico-compose-m3 = { module = "com.patrykandpatryk.vico:compose-m3", version.ref = "vico" }
[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
[bundles]
ev...@tatarka.me <ev...@tatarka.me> #8
Ran into the same issue, the onValuChangeFinished lambda is being passed as a remember key so recreates the state if that lambda reference changes (as seen in
val context = LocalContext.current
var sliderPosition by remember { mutableStateOf(0f) }
val onValueChangeFinished: () -> Unit = remember {
{ Toast.makeText(context, sliderPosition.toString(), Toast.LENGTH_SHORT).show() }
}
Text(text = sliderPosition.toString())
Slider(
value = sliderPosition,
onValueChange = { sliderPosition = it },
onValueChangeFinished = onValueChangeFinished
)
ke...@google.com <ke...@google.com>
co...@google.com <co...@google.com> #9
Feb 19 is a U.S. holiday, there are 12+ impacted so far, Kevin, could you please take a look on tues once you are back at work? ty!
ke...@google.com <ke...@google.com> #10
Yup, taking a look. Thanks Connie!
ke...@google.com <ke...@google.com>
ap...@google.com <ap...@google.com> #11
Project: platform/frameworks/support
Branch: androidx-main
commit dde2e9109164e8cf8e8bad4a28954d35cad19d76
Author: Kevin Truong <kevinctruong@google.com>
Date: Fri Jan 26 13:24:33 2024
[Slider] Fix for using Toast or Snackbar in onValueChangeFinished
Remove onValueChangeFinished as a key to remember for Slider and RangeSlider.
Set the value of state.onValueChangeFinished to onValueChangeFinished in stateless APIs, so any new version of onValueChangeFinished is still
propagated to the state. Removing @Stable from the states since state.onValueChangeFinished is now a var.
Bug: 322269951
Test: Adding test for Slider and RangeSlider that triggers a snackbar in onValueChangeFinished. Testing that both Slider and RangeSlider drag to the correct position without the snackbar causing ths slider to stop drag.
Relnote: Removing @Stable from the states of Slider since we're changing state.onValueCHangeFinished to a var.
Change-Id: Ied34a92fed040ceeb5d676d6f75767ee33762cfb
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/SliderTest.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
https://android-review.googlesource.com/2930335
Branch: androidx-main
commit dde2e9109164e8cf8e8bad4a28954d35cad19d76
Author: Kevin Truong <kevinctruong@google.com>
Date: Fri Jan 26 13:24:33 2024
[Slider] Fix for using Toast or Snackbar in onValueChangeFinished
Remove onValueChangeFinished as a key to remember for Slider and RangeSlider.
Set the value of state.onValueChangeFinished to onValueChangeFinished in stateless APIs, so any new version of onValueChangeFinished is still
propagated to the state. Removing @Stable from the states since state.onValueChangeFinished is now a var.
Bug: 322269951
Test: Adding test for Slider and RangeSlider that triggers a snackbar in onValueChangeFinished. Testing that both Slider and RangeSlider drag to the correct position without the snackbar causing ths slider to stop drag.
Relnote: Removing @Stable from the states of Slider since we're changing state.onValueCHangeFinished to a var.
Change-Id: Ied34a92fed040ceeb5d676d6f75767ee33762cfb
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/SliderTest.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
ap...@google.com <ap...@google.com> #12
Project: platform/frameworks/support
Branch: androidx-main
commit 74979312fabd3061fcb2cf34714c3afc1ffe2088
Author: Kevin Truong <kevinctruong@google.com>
Date: Tue Feb 27 12:38:49 2024
[Slider] Making States Stable
Making the states stable again, making State.onValueChangeFinished a val again, and wrapping onValueChangeFinished with a rememberUpdatedState.
Bug: 322269951
Test: N/A
Relnote: Making the states stable again. Making State.onValueChangeFinished a val again. Wrapping onValueChangeFinished in a rememberUpdatedState.
Change-Id: I82ab29f469b01077eb17a70204f43b7a154abc1d
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
https://android-review.googlesource.com/2980132
Branch: androidx-main
commit 74979312fabd3061fcb2cf34714c3afc1ffe2088
Author: Kevin Truong <kevinctruong@google.com>
Date: Tue Feb 27 12:38:49 2024
[Slider] Making States Stable
Making the states stable again, making State.onValueChangeFinished a val again, and wrapping onValueChangeFinished with a rememberUpdatedState.
Bug: 322269951
Test: N/A
Relnote: Making the states stable again. Making State.onValueChangeFinished a val again. Wrapping onValueChangeFinished in a rememberUpdatedState.
Change-Id: I82ab29f469b01077eb17a70204f43b7a154abc1d
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
na...@google.com <na...@google.com> #13
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3:1.2.1
androidx.compose.material3:material3-android:1.2.1
androidx.compose.material3:material3-desktop:1.2.1
androidx.compose.material3:material3:1.3.0-alpha02
androidx.compose.material3:material3-android:1.3.0-alpha02
androidx.compose.material3:material3-desktop:1.3.0-alpha02
Description
Jetpack Compose version: compose-ui = "1.6.0", compose-foundation = "1.6.0", material3-android = "1.2.0-rc01"
Jetpack Compose component used: Slider
Android Studio Build: Giraffe | 2022.3.1 Patch 3
Kotlin version: 1.8.10
Code Sample to Reproduce:
Now if you run the app and try to slide the slider, the sliding gets interrupted, and onValueChangeFinished is called continuously.
This problem occurs also in version "1.2.0-beta01" and above.