@Test public void showModal() { Options defaultOptions = new Options(); uut.setDefaultOptions(defaultOptions); disableShowModalAnimation(modal1); uut.showModal(modal1, root, new CommandListenerAdapter()); verify(modal1).setWaitForRender(any()); verify(modal1).resolveCurrentOptions(defaultOptions); }
void showModal(ViewController toAdd, ViewController toRemove, CommandListener listener) { if (modalsLayout == null) { listener.onError("Can not show modal before activity is created"); return; } Options options = toAdd.resolveCurrentOptions(defaultOptions); toAdd.setWaitForRender(options.animations.showModal.waitForRender); modalsLayout.addView(toAdd.getView()); if (options.animations.showModal.enabled.isTrueOrUndefined()) { if (options.animations.showModal.waitForRender.isTrue()) { toAdd.setOnAppearedListener(() -> animateShow(toAdd, toRemove, listener, options)); } else { animateShow(toAdd, toRemove, listener, options); } } else { if (options.animations.showModal.waitForRender.isTrue()) { toAdd.setOnAppearedListener(() -> onShowModalEnd(toAdd, toRemove, listener)); } else { onShowModalEnd(toAdd, toRemove, listener); } } }
ModalPresenter { void showModal(ViewController toAdd, ViewController toRemove, CommandListener listener) { if (modalsLayout == null) { listener.onError("Can not show modal before activity is created"); return; } Options options = toAdd.resolveCurrentOptions(defaultOptions); toAdd.setWaitForRender(options.animations.showModal.waitForRender); modalsLayout.addView(toAdd.getView()); if (options.animations.showModal.enabled.isTrueOrUndefined()) { if (options.animations.showModal.waitForRender.isTrue()) { toAdd.setOnAppearedListener(() -> animateShow(toAdd, toRemove, listener, options)); } else { animateShow(toAdd, toRemove, listener, options); } } else { if (options.animations.showModal.waitForRender.isTrue()) { toAdd.setOnAppearedListener(() -> onShowModalEnd(toAdd, toRemove, listener)); } else { onShowModalEnd(toAdd, toRemove, listener); } } } }
ModalPresenter { void showModal(ViewController toAdd, ViewController toRemove, CommandListener listener) { if (modalsLayout == null) { listener.onError("Can not show modal before activity is created"); return; } Options options = toAdd.resolveCurrentOptions(defaultOptions); toAdd.setWaitForRender(options.animations.showModal.waitForRender); modalsLayout.addView(toAdd.getView()); if (options.animations.showModal.enabled.isTrueOrUndefined()) { if (options.animations.showModal.waitForRender.isTrue()) { toAdd.setOnAppearedListener(() -> animateShow(toAdd, toRemove, listener, options)); } else { animateShow(toAdd, toRemove, listener, options); } } else { if (options.animations.showModal.waitForRender.isTrue()) { toAdd.setOnAppearedListener(() -> onShowModalEnd(toAdd, toRemove, listener)); } else { onShowModalEnd(toAdd, toRemove, listener); } } } ModalPresenter(ModalAnimator animator); }
ModalPresenter { void showModal(ViewController toAdd, ViewController toRemove, CommandListener listener) { if (modalsLayout == null) { listener.onError("Can not show modal before activity is created"); return; } Options options = toAdd.resolveCurrentOptions(defaultOptions); toAdd.setWaitForRender(options.animations.showModal.waitForRender); modalsLayout.addView(toAdd.getView()); if (options.animations.showModal.enabled.isTrueOrUndefined()) { if (options.animations.showModal.waitForRender.isTrue()) { toAdd.setOnAppearedListener(() -> animateShow(toAdd, toRemove, listener, options)); } else { animateShow(toAdd, toRemove, listener, options); } } else { if (options.animations.showModal.waitForRender.isTrue()) { toAdd.setOnAppearedListener(() -> onShowModalEnd(toAdd, toRemove, listener)); } else { onShowModalEnd(toAdd, toRemove, listener); } } } ModalPresenter(ModalAnimator animator); void setRootLayout(ViewGroup rootLayout); void setDefaultOptions(Options defaultOptions); }
ModalPresenter { void showModal(ViewController toAdd, ViewController toRemove, CommandListener listener) { if (modalsLayout == null) { listener.onError("Can not show modal before activity is created"); return; } Options options = toAdd.resolveCurrentOptions(defaultOptions); toAdd.setWaitForRender(options.animations.showModal.waitForRender); modalsLayout.addView(toAdd.getView()); if (options.animations.showModal.enabled.isTrueOrUndefined()) { if (options.animations.showModal.waitForRender.isTrue()) { toAdd.setOnAppearedListener(() -> animateShow(toAdd, toRemove, listener, options)); } else { animateShow(toAdd, toRemove, listener, options); } } else { if (options.animations.showModal.waitForRender.isTrue()) { toAdd.setOnAppearedListener(() -> onShowModalEnd(toAdd, toRemove, listener)); } else { onShowModalEnd(toAdd, toRemove, listener); } } } ModalPresenter(ModalAnimator animator); void setRootLayout(ViewGroup rootLayout); void setDefaultOptions(Options defaultOptions);  }