I'm trying to make shared element transition work with an element inside a recycler view. When the user clicks on a textview inside my recycler view item, the Detail Activity opens. Inside Detail Activity, I display some infos and I also have a tab layout that loads some images from url using picasso. The transition to Detail Activity is working, but if the user returns to Main Activity before have loaded all images, the recycler view in Main Activity dissapers after the reverse animation! When I disable shared element transition, the problem is gone.
Both activities work with fragments. So, I'm trying to create a transition between two fragments, which are in different activities.
In RecyclerViewAdapter, I set the transition name:
public void onBindViewHolder(final ViewHolder viewHolder, int position) {
...
viewHolder.profileImage.setTransitionName("profile"+position);
onClickListener of my textview (inside a fragment in Main Activity):
Intent i = new Intent(getCurrentActivity(), DetailActivity.class);
ActivityOptionsCompat options = ActivityOptionsCompat.
makeSceneTransitionAnimation(getCurrentActivity(), (View) profileImage, "profile"+position);
getCurrentActivity().startActivity(i, options.toBundle());
Inside the fragment of Detail Activity that has the shared element (in onCreateView):
profileImage.setTransitionName("profile"+position);
I already checked the transition name in both activities when the intent occurs and its the same.
I'm stuck in this problem for two days and can't see what is happening. If you need more info or code about it, just ask.
Thank you!