sunflower icon indicating copy to clipboard operation
sunflower copied to clipboard

Hero image transition animation

Open andhie opened this issue 7 years ago • 7 comments

Doing transition animation to detail activity via the hero image

Work to do: Use ActivityOptionsCompat#makeSceneTransitionAnimation(). for the animation by passing in activity and the imageview. Each list item in Plant adapter should use ViewCompat#setTransitionName() and prefix/suffixed with item position. Both list and detail imageview need to have same transition name. this allows anim to transition backwards when user press back on Detail activity We need to delay anim in detail via supportPostponeEnterTransition() until Glide loads the image and then use supportStartPostponedEnterTransition()

https://developer.android.com/reference/android/support/v4/app/ActivityOptionsCompat.html#makescenetransitionanimation_4 https://developer.android.com/reference/android/support/v4/view/ViewCompat.html#setTransitionName(android.view.View,%20java.lang.String)

andhie avatar Jun 25 '18 10:06 andhie

Related to #9

tiembo avatar Jun 25 '18 18:06 tiembo

@andhie now that #9 is resolved and the app is a single activity, the work outlined might need to change a bit.

tiembo avatar Jun 28 '18 17:06 tiembo

For normal fragments, we can use setSharedElement on the FragmentTransaction. but in the case of Navigation, i'm not sure how you achieve this. is it supported at this moment?

andhie avatar Jul 02 '18 06:07 andhie

@andhie shared element transitions with the Navigation component is in the works: https://issuetracker.google.com/issues/79665225

tiembo avatar Jul 02 '18 21:07 tiembo

nudge. this would be great

neiljaywarner avatar Sep 20 '18 18:09 neiljaywarner

@andhie shared element transitions are now available in Navigation 1.0.0-alpha06, which has been merged via #193

tiembo avatar Sep 20 '18 21:09 tiembo

@tiembo i have committed some code in my own repo. in the FragmentNavigator see its adding the Navigator.Extras into the ft.addSharedElement(...) yet its not animating. cant figure out why. https://github.com/andhie/android-sunflower/commit/33d9aa9c6a97bc186aac7455df8981728d8beed4

andhie avatar Sep 21 '18 10:09 andhie