Open andhie opened 6 years ago
Related to #9
@andhie now that #9 is resolved and the app is a single activity, the work outlined might need to change a bit.
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 shared element transitions with the Navigation component is in the works: https://issuetracker.google.com/issues/79665225
nudge. this would be great
@andhie shared element transitions are now available in Navigation 1.0.0-alpha06, which has been merged via #193
@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
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 useViewCompat#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 viasupportPostponeEnterTransition()
until Glide loads the image and then usesupportStartPostponedEnterTransition()
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)