https://kotlinlang.org logo
#decompose
Title
# decompose
a

Arkadii Ivanov

11/25/2023, 7:54 PM
Decompose
2.2.0-beta02
is released! - Added
materialPredictiveBackAnimatable
as a default animation - LTR/RTL support in
PredictiveBackGestureOverlay
- Fixed
PredictiveBackGestureOverlay
swipe edges not changing Release notes: https://github.com/arkivanov/Decompose/releases/tag/2.2.0-beta02
🙌 3
s

s3rius

11/26/2023, 12:30 PM
Thanks for being so on top of the new stuff! I noticed a few things about the documentation that I thought were confusing: 1. You write "To enable the gesture, first implement
BackHandlerOwner
interface in your component" but BackHandlerOwner is already part of ComponentContext. The description makes it sound like there's actual work to do, but it's only a technicality because of the interface/implementation structure you're using. 2. The animated image in the docs is probably now wrong because the new MaterialPredictiveAnimatable doesn't modify the alpha of the component anymore. 3. Perhaps you could detail what the
animation
param of
predictiveBackAnimation
is used for. My initial intuition was that it defines the animation of the component during the predictive animation. It took a little longer to understand that it defines the non-predictive animation. The phase "regular animation" didn't really click for me. Maybe calling the parameter
fallbackAnimation
or
nonPredictiveAnimation
might help? Finally, I copied the
MaterialPredictiveBackAnimatable
to create a variant that also performs fading (like the image from 2.) That worked well except for
Modifier.withLayoutCorners
which is internal and not trivial to just copy-over. Perhaps it would be useful to expose it as some form of
defaultMaterialPredictiveLayoutCorners()
that library consumers can make use of.
a

Arkadii Ivanov

11/26/2023, 1:12 PM
Thanks for the feedback!
The description makes it sound like there's actual work to do
The documentation contains a code snippet saying:
Copy code
// ComponentContext already implements BackHandlerOwner, no need to implement it separately
I agree that it might be confusing, perhaps we could replace "implement" with "add", or something similar.
The animated image in the docs is probably now wrong
Correct. I was a bit lazy to update those GIFs 🙂 Though, the docs now explicitly mentions and refers to the actual animation design. Contributions are welcome! https://arkivanov.github.io/Decompose/getting-started/contributing/
Perhaps you could detail what the
animation
param of
predictiveBackAnimation
is used for.
I also thought about it. I think
fallbackAnimation
would be better here. It's too late to id in v2.2, as it has just reached Beta. But I've filed an issue for v3.0 - https://github.com/arkivanov/Decompose/issues/541.
s

s3rius

11/26/2023, 2:19 PM
The documentation contains a code snippet saying:
Wow, not sure how I missed that!
d

Dennis

11/27/2023, 6:42 AM
Good stuff Arkadii Thank you
🙌 1