skydoves / TransformationLayout

🌠 Transform between two Views, Activities, and Fragments, or a View to a Fragment with container transform animations for Android.
Apache License 2.0
2.36k stars 191 forks source link

Transition noo work when return to Fragment with RecyclerView #22

Closed Avgur123 closed 3 years ago

Avgur123 commented 3 years ago

I have a grid recyclerview in fragment, which hosted in viewpager. Transition normally works when i open DetailFragment, but no transition effect when press back button...What i'm missing? I use ListAdapter.

//frag with recyclerview override fun onCreate(savedInstanceState: Bundle?) { onTransformationStartContainer() super.onCreate(savedInstanceState) }

// put bundle fun newInstance(artist_id: Int, transformationLayout:TransformationLayout): ArtistInfo { val fragment = ArtistInfo() fragment.transition_name=transformationLayout.transitionName val bundle = transformationLayout?.getBundle("TransformationParams") bundle.putInt("artist_id", artist_id) fragment.arguments = bundle return fragment } // detailfrag override fun onCreate(savedInstanceState: Bundle?) { val params = arguments?.getParcelable("TransformationParams") onTransformationEndContainer(params) super.onCreate(savedInstanceState)

// loading new fragment val transaction = supportFragmentManager.beginTransaction() .addTransformation(transformationLayout) .replace(R.id.albumFragcontainer, fragment, tag) .addToBackStack(tag) .commit()

skydoves commented 3 years ago

Hi, you can reference the demo project. Thanks.