In order to let shared element transition run smoothly, I need to postpone the heavy initialization at my destination activity. See code below:
getWindow().setSharedElementEnterTransition(enterTransition);
enterTransition.addListener(new Transition.TransitionListener() {
@Override
public void onTransitionEnd(Transition transition) {
init();
}
});
However, if this Activity is started from Deep link
or another activity that do not have shared element. The transition never start, thus onTransitionEnd()
never be called and init()
will never run. In that case, I should call init()
immediately after the Activity started.
How can I know that the transition is going to run?
EDIT
I also want to run another enter transition if the shared element transition is not available. So answer below that suggest using postponeEnterTransition()
does not work for my case.