Status Update
Comments
ma...@gmail.com <ma...@gmail.com> #2
I'm not convinced that this is actually a duplicate of the other issue. In part it is, certainly - that covers Fragment shared element transitions. But this issue covers Activity shared element transitions as well, which are not covered by the other issue. I'm happy to open a separate issue for that specifically if you prefer or you could just re-open this issue.
Description
Version used: 1.0.0-alpha04
Devices/Android versions reproduced on:
Shared Element Transitions do not appear to be supported by the Navigation Architecture Component 1.0.0-alpha04.
For Fragment shared element transitions the shared element definitions need to be added to the FragmentTransaction using the addSharedElement() method, but this is not exposed through the Navigation resource XML or editor.
For Activity shared element transitions it should be possible to create an options bundle containing the shared element definitions, and should therefore work. However, when navigating using an action defined in the navigation graph, but when doing this ActivityNavigator#navigate() calls overridePendingTransitions(-1, -1) on the outgoing Activity if no transitions are explicitly defined for the action. This results in system default transitions being used, which prevent shared element transitions from working. To be able to use shared element transitions we need to call overridePendingTransitions(0, 0) to disable transitions and allow shared element transitions to be used instead. Therefore the editor showing 'none' when no transitions are specified is not strictly correct as it is implemented to use the system defaults if nothing is explicitly set. This problem could be overcome by having 'default' and 'none' as options in the editor to use values of '-1' and '0' respectively for overridePendingTransitions().