I'm trying to wrap my head around implementation of shared view transitions between fragments
The challenge is coming from the MVVP restricitons:
- Adapter of
RecycleViewhas knowledge of selected element and view attached via callback fromView - Adapter is passing information about click to
ViewModelstripping out all information about view, as it can't hold it. That's because of rule - no android imports inViewModelexcept of*arch ViewModelsends event toFragmentto open anotherFragment- At this point
Fragmentdoesn't know what view to use to start transition in.addSharedElement(..)
How to address this issue?
I was thinking about saving reference to clicked View inside Fragment instance but it looks like a cheating
Any ideas and suggestions are very welcome