Status Update
Comments
ap...@google.com <ap...@google.com> #2
Branch: androidx-master-dev
commit 3d00acd443e0e5dd2cc33eb314a65f78f21cec61
Author: Calin Tataru <calintat@google.com>
Date: Mon Aug 10 17:59:53 2020
Modifier.swipeable polishing
This CL does the following things:
* Expand the documentation in SwipeableState.
* Make the setter of SwipeableState.value private.
* Rename some of the properties in SwipeableState, and slightly change
the definition of swipeTarget (now called targetValue) so that it uses
the target value of the ongoing animation if isAnimationRunning = true.
* Add a rememberSwipeableState function to help reduce boilerplate.
* Add Savers for [Drawer/BottomDrawer/Dismiss/Swipeable]State, so that
we can use rememberSavedInstanceState in the rememberFooState functions.
Bug: 163129614
Bug: 163132293
Test: Ran SwipeableTest and other tests depending on swipeable
Relnote: "Renamed some properties in SwipeableState: swipeTarget ->
targetValue, swipeProgress -> progress, swipeDirection -> direction.
Added a rememberSwipeableState function for creating SwipeableStates."
Change-Id: I2fc9c3af465b579a18359ae0aa0853c2d2b02abe
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/SwipeToDismissSamples.kt
M ui/ui-material/samples/src/main/java/androidx/compose/material/samples/SwipeableSamples.kt
M ui/ui-material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeableTest.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/SwipeToDismiss.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
M ui/ui-material/src/commonMain/kotlin/androidx/compose/material/Switch.kt
ca...@google.com <ca...@google.com> #3
I added a rememberSwipeableState
function to easily create and remember a SwipeableState
with the default animation clock. That should work perfectly for your usecase.
bl...@gmail.com <bl...@gmail.com> #4
Regression in material3: the function is now marked internal. Please re-open.
ma...@google.com <ma...@google.com> #6
Thanks for your feedback. We are looking into the ways of improving the current Mosidifer.swipeable, it has a number of critical bugs and we don't want to publish it as-is in material3. Stay tuned
ke...@gmail.com <ke...@gmail.com> #7
I would like to add one thing (if it's not planned in the new swipeable() yet).
Right now, if you add an anchor, lets say 0..100 then it works as expected if you swipe from left (0) to right (100). However when doing the opposite swipe (from right 100 to left 0), instead of just not doing anything, swipeable shows the "overscroll" (or rather "overstretch") effect and consumes the scroll events if it's located in a horizontally scrollable container.
For example, let's say I want to put swipeable elements inside of the drawer. I want to be able to swipe to the right to "remove" the elements but I also want to be able to close the drawer by swiping to the left. Right now the drawer is impossible to close by swiping to the left. There needs to be some kind of a flag to disable this default behavior and to hint the swipeable to not consume scroll events in this and similar cases.
Description
Currently creating a
SwipeableState
involves some boiler-plate:SwipeableState
AnimationClockObservable
is and how I procure one.remember
it.A factory function producing this for me would be very convenient.