Shared Element Transaction have a set of provided transistion types, slide_top, slide_bottom, fade, move etc in android.R.transition.
My app : API 21 :: Single activity
Fragment1 : Nested Recyclerview: A vertical recycler view, where each element is a horizontal recycler view. Each element in the latter is an image view fetched with Picasso.
Fragment 2: Detail view with larger sized image.
I went through various posts like this one to build it up. All core elements of implementing shared element transitions are built correctly as evident from the fact that both fade and slide_top/bottom/right/left work correctly.
First fragment:
setSharedElementReturnTransition(TransitionInflater.from(getActivity())
.inflateTransition(android.R.transition.slide_top));
Fragment pFragment = PFragment.newInstance(item, transitionName);
pFragment.setSharedElementEnterTransition(new ChangeBounds());
getFragmentManager()
.beginTransaction()
.replace(R.id.fragment_container, pFragment)
.addSharedElement(sharedImageView,
sharedImageView.getTransitionName())
.addToBackStack(null)
.commit();
Second Fragment:
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (getArguments() != null) {
mSId = getArguments().getString(KEY_S);
transitionName = getArguments().getString(KEY_T);
img = (ImageView) view.findViewById(R.id.s_image);
ViewCompat.setTransitionName(img, transitionName);
Log.e(TAG, "Transition name is " + transitionName);
}
PicassoWithAuth.getImageLoader(getActivity()).with(getActivity())
.load(R.drawable.dummy).into(img, new Callback() {
@Override
public void onSuccess() {
ActivityCompat.startPostponedEnterTransition(getActivity());
}
@Override
public void onError() {
}
});
}
ISSUE:
However, i'm not able to make the move transition work, even when i try to apply a manual transition set with changeBounds and changeImageTransformation nothing happens and the new fragment replaces the old one without any transition. Only changing setSharedElementReturnTransition
to fade or slide_top etc works fine, but nothing that actually reads the bounds and transistions the size.
I'v already tried setting ActivityCompat.postponeEnterTransition(getActivity()); on my new fragment.
QUESTION: 1. Is there a fundamental issue in sharedElementTransition that doesnt allow it to work with nested recyclers? 2. Is there something i missed in the implementation?
TIA