Fixed
Status Update
Comments
na...@google.com <na...@google.com>
yb...@google.com <yb...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit b6c7c78f9e7476b468dafe9d5f7dec6794d47f09
Author: Shahd AbuDaghash <shahddaghash@google.com>
Date: Mon Nov 27 11:16:51 2023
Introduce DecayAnimation in AnchoredDraggable
Decay animation allows more realistic settling of a component. This is performed by now passing a `DecayAnimationSpec` parameter to AnchoredDraggable and using it when animating to the target. The new animation implementation will be added in a chain CL.
Bug: 288084801
Test: Tests will be added in a chain CL
Relnote: This change adds a `decayAnimationSpec` parameter to AnchoredDraggable allowing to use decay animation when settling to one of the anchors. The change also includes renaming the existing `animationSpec` to `snapAnimationSpec` to help understanding the use case of each spec.
Change-Id: I44ccd408d919328fd6504d31d8db59cf1d07de43
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/AnchoredDraggableSample.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableGestureTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableStateTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/AnchoredDraggable.kt
https://android-review.googlesource.com/2847074
Branch: androidx-main
commit b6c7c78f9e7476b468dafe9d5f7dec6794d47f09
Author: Shahd AbuDaghash <shahddaghash@google.com>
Date: Mon Nov 27 11:16:51 2023
Introduce DecayAnimation in AnchoredDraggable
Decay animation allows more realistic settling of a component. This is performed by now passing a `DecayAnimationSpec` parameter to AnchoredDraggable and using it when animating to the target. The new animation implementation will be added in a chain CL.
Bug: 288084801
Test: Tests will be added in a chain CL
Relnote: This change adds a `decayAnimationSpec` parameter to AnchoredDraggable allowing to use decay animation when settling to one of the anchors. The change also includes renaming the existing `animationSpec` to `snapAnimationSpec` to help understanding the use case of each spec.
Change-Id: I44ccd408d919328fd6504d31d8db59cf1d07de43
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/AnchoredDraggableSample.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableGestureTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableStateTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/AnchoredDraggable.kt
al...@android.com <al...@android.com>
ya...@gmail.com <ya...@gmail.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 365993d1a90c27704b71f6bee042a1749314a4b1
Author: Shahd AbuDaghash <shahddaghash@google.com>
Date: Tue Nov 28 10:49:56 2023
Add tests for Animation in AnchoredDraggable
Added tests to check for different settling behaviors.
Bug: 288084801
Test: Added tests to verify behavior.
Change-Id: I369b30c69f7c29f676ae0671fef25c38ff3c74cb
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableStateTest.kt
https://android-review.googlesource.com/2847475
Branch: androidx-main
commit 365993d1a90c27704b71f6bee042a1749314a4b1
Author: Shahd AbuDaghash <shahddaghash@google.com>
Date: Tue Nov 28 10:49:56 2023
Add tests for Animation in AnchoredDraggable
Added tests to check for different settling behaviors.
Bug: 288084801
Test: Added tests to verify behavior.
Change-Id: I369b30c69f7c29f676ae0671fef25c38ff3c74cb
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableStateTest.kt
pa...@gmail.com <pa...@gmail.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit ff1a600df5f4d8ae21a75d8e3e0f24d6c5c2faee
Author: Shahd AbuDaghash <shahddaghash@google.com>
Date: Mon Nov 27 15:51:12 2023
Modify settle function to perform decay animation if possible
When settling, a check will be performed to see if natural decay animation can be used. If not so, a target animation will be used. The consumed velocity is returned to the settle function, which could be used to show an overscroll effect.
Bug: 288084801
Test: Tests will be added in a chain CL.
Relnote: This change introduces a new `animateToWithDecay` function that naturally decays if possible. It takes the target value and the initial velocity. The `animateTo` functions no longer takes a velocity, but passes the available velocity in `lastVelocity` to animation, as it is concerned with reaching the target. If users need to pass a certain velocity for animation, they can use `animateToWithDecay` function.
Change-Id: I465dbd826e3969b784d08c65425f4bbda3de8493
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/AnchoredDraggable.kt
https://android-review.googlesource.com/2847576
Branch: androidx-main
commit ff1a600df5f4d8ae21a75d8e3e0f24d6c5c2faee
Author: Shahd AbuDaghash <shahddaghash@google.com>
Date: Mon Nov 27 15:51:12 2023
Modify settle function to perform decay animation if possible
When settling, a check will be performed to see if natural decay animation can be used. If not so, a target animation will be used. The consumed velocity is returned to the settle function, which could be used to show an overscroll effect.
Bug: 288084801
Test: Tests will be added in a chain CL.
Relnote: This change introduces a new `animateToWithDecay` function that naturally decays if possible. It takes the target value and the initial velocity. The `animateTo` functions no longer takes a velocity, but passes the available velocity in `lastVelocity` to animation, as it is concerned with reaching the target. If users need to pass a certain velocity for animation, they can use `animateToWithDecay` function.
Change-Id: I465dbd826e3969b784d08c65425f4bbda3de8493
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/AnchoredDraggable.kt
Description
Repro:
Create a sample app with Tabs and Fragment
in the fragment have this order:
- FrameLayout A width and height match_parent
- CardView B width match_parent and height wrap_content
- RecyclerView C width match_parent and height wrap_content
XML: FrameLayout A->CardView B->RecyclerView C
Layout file for the adapter:
- LinearLayout A width and height match_parent, orientation vertical
- LinearLayout B width and height match_parent, orientation horizontal
- TextView C width 0dp weight 1 and height wrap_content
- TextView D width 0dp weight 1 and height wrap_content
XML: LinearLayout A->LinearLayout B->TextView C, TextView D
If I try to scroll by touching the tabs on landscape then the view gets scrolled and the card is fully visible like on portrait