i am trying to add shared element transition into my app.
Scenario is that user clicks on image thumbnail which than opens another activity with full screen image view.
This works fine if shared view is hosted directly within layout of target activity. Works smoothy for enter/exit animation. But when i'am trying to achieve similar effect within fragment which is nested in target activity this approach doesn't work. Funny thing is that enter animation is not showed, but exit animation is working fine .
Another even more complicated view hierarchy is that if target view (ImageView) is hosted within view pager which is hosted in frame layout of target activity.
Does someone had same issue ?
Edit: My click listener code
public class OnClickPicture extends OnClickBase {
private ObjectPicture object;
public OnClickPicture(Activity_Parent activity, ObjectPicture object) {
super(activity);
this.object = object;
}
public void onClick(View v) {
picasso.load(object.getFullUrl()).fetch();
Intent intent = new Intent(activity, ActivityPicture.class);
intent.putExtra("picture_object", helper.gson.toJson(object));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && v != null) {
Pair<View, String> p1 = Pair.create(v, "image");
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, p1);
activity.startActivity(intent, options.toBundle());
} else {
activity.startActivity(intent);
}
}
}