Transportr icon indicating copy to clipboard operation
Transportr copied to clipboard

Smoother animations for trip details

Open ialokim opened this issue 6 years ago • 7 comments

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.

ialokim avatar Nov 02 '19 11:11 ialokim

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?

ialokim avatar Dec 07 '19 22:12 ialokim

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?

grote avatar Dec 10 '19 14:12 grote

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.

ialokim avatar Dec 10 '19 22:12 ialokim

Isn't this just about sliding in the bars where you otherwise set a visibility hard?

grote avatar Dec 10 '19 22:12 grote

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?

ialokim avatar Dec 10 '19 22:12 ialokim

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.

grote avatar Dec 10 '19 23:12 grote

MotionLayout is now officially released with ConstraintLayout 2.0.0.

ialokim avatar Sep 09 '20 21:09 ialokim