There appears to be an issue where the user can still interact with an exiting Controller.
The following code is in an onClick method in ControllerA. It creates a ControllerB and pushes it. The change handler uses an AnimatorSet of scales and rotations to switch between the controllers.
final RouterTransaction transaction = RouterTransaction.with(ControllerB.createInstance())
.pushChangeHandler(new CrossRotateChangeHandler())
.popChangeHandler(new CrossRotateChangeHandler());
getRouter().pushController(transaction);
The problem is that as ControllerA is transitioning away, I can still interact with it. In this case, it will create a second ControllerB and push it on top, such that the stack is now A->B->B`, and the animation will suddenly jank to be animating between B and B`.
This is easy to reproduce when setting the Animator duration scale in dev options.
The net effect of this is that all Controllers need to have ugly defensive code like this:
final String tag = ControllerB.class.getName();
if (getRouter().getControllerWithTag(tag) == null) {
final RouterTransaction transaction = RouterTransaction.with(ControllerB.createInstance())
.pushChangeHandler(new CrossRotateChangeHandler())
.popChangeHandler(new CrossRotateChangeHandler())
.tag(tag);
getRouter().pushController(transaction);
}
Shouldn't Conductor prevent interaction with the exiting Controller?
If you use a ChangeHandlerFrameLayout as your router container this will be taken care of for you.
馃槺
Is that a reason why I sometimes get null when calling getActivity in an OnClickListener?
No, that was that wrong question.
Can this be the reason my onClick gets called after the hosting activity's onDestroy?
Most helpful comment
If you use a
ChangeHandlerFrameLayoutas your router container this will be taken care of for you.