I have a RecyclerView
inside the fragment in a Viewpager and sharing element from an item in the RecyclerView
to a DetailActivity
containing a fragment. I am setting transition inside the DetailActivity
for the entry and exit of the fragment.
public static void sharedTransitionReceiver(Activity activity, Fragment fragment) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().getEnterTransition().setDuration(500);
Slide slideTransition = new Slide(Gravity.START);
slideTransition.setDuration(500);
fragment.setReenterTransition(slideTransition);
fragment.setExitTransition(slideTransition);
fragment.setSharedElementEnterTransition(new ChangeBounds());
}
}
It is working just fine but when I navigate back to the previous activity containing the Viewpager exit animations are not working and item won't animates back to their original position.