Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TransitionManager progress manually

I am currenlty exploring a somewhat complex UI similar to the BottomSheetBehaviour used in Google Maps, where one can animate an item from a collapsed state into an expanded state. The transition between those 2 states are Scene Transitions using the TransitionManager framework and work rather nicely.

I am now exploring a way to drag the expanded view again into the collapsed state and vice versa, but I did not find any obvious way to manually progress a scene transition.

What I would need would be something like: Transition.setAnimatedFraction(0.5f) based on the percentage the user has dragged between the 2 states.

A drag transition between those 2 states

Does anyone here have any idea on how to achieve that?

like image 349
saberrider Avatar asked Aug 16 '17 15:08

saberrider


1 Answers

Migrating your parent ViewGroup (whatever is ConstraintLayout, RelativeLayout or anything else) to MotionLayout you can achieve this using MotionLayout.progress (setProgress(float)) and loadLayoutDescription which give you power to process manually progress of a scene transition described in a motion scene.

Please see examples here.

like image 95
Arsenius Avatar answered Sep 19 '22 20:09

Arsenius