Smoother animations for trip details
As remarked by @grote in https://github.com/grote/Transportr/pull/627#discussion_r341580219:
These visibility changes on swiping in the trip details view in https://github.com/grote/Transportr/blob/4a1f997bea61490fe5eac1d668ac7b6feb6a3adf/app/src/main/java/de/grobox/transportr/trips/detail/TripDetailFragment.kt#L144-L171 appear a bit rough in the UI. Should be easy to use a object animator instead here to make things more smooth.
I've been working on this some time ago and managed to animate the color, but for animating the actual objects the current available options seem to be quite difficult.
I've found MotionLayout to be a very easy method of animating the transition between different layouts. This API is part of androidX ConstraintLayout version 2, which is currently still in beta stage. Would you mind upgrading to this beta release or prefer waiting for the final release to incorporate these smoother animations in Transportr?
MotionLayout looks super interesting and I meant to play with it as well. If you get something working with that, we can pull in the beta release if it doesn't have any known issues that affect us.
Otherwise, using an ObjectAnimator isn't very difficult and this is a relatively simple task. Did you check how we move things around when enabling/disabling the via location input field?
Otherwise, using an ObjectAnimator isn't very difficult and this is a relatively simple task.
When I investigated about this, I came to the conclusion that manually setting the percentage (progress) of the animation (which would be necessary for a smooth animation following the finger sliding) is not possible with ObjectAnimator. That's why I searched for other possibilities.
I would look into MotionLayout then with some time.
Isn't this just about sliding in the bars where you otherwise set a visibility hard?
I've been thinking about a transition between the states while sliding the sheet up or down, but a simple animation when setting the sheet state might as well work. What would you prefer?
I'd just to the simple thing for now which is sliding out the bars after making them visible. Fancy MotionLayout stuff we can do later.
MotionLayout is now officially released with ConstraintLayout 2.0.0.