@Test public void resolvedOptionsAreAppliedWhenStackIsAttachedToParentAndNotVisible() { FrameLayout parent = new FrameLayout(activity); activity.setContentView(parent); ViewController child = new SimpleViewController(activity, childRegistry, "child1", new Options()); StackController stack = createStack(Collections.singletonList(child)); stack.getView().setVisibility(View.INVISIBLE); parent.addView(stack.getView()); Component component = (Component) child.getView(); verify(presenter).applyChildOptions(any(), eq(component)); }
@Override public void applyChildOptions(Options options, Component child) { super.applyChildOptions(options, child); presenter.applyChildOptions(resolveCurrentOptions(), child); if (child instanceof ReactComponent) { fabOptionsPresenter.applyOptions(this.options.fabOptions, (ReactComponent) child, getView()); } performOnParentController(parentController -> ((ParentController) parentController).applyChildOptions( this.options.copy() .clearTopBarOptions() .clearAnimationOptions() .clearFabOptions() .clearTopTabOptions() .clearTopTabsOptions(), child ) ); }
StackController extends ParentController<StackLayout> { @Override public void applyChildOptions(Options options, Component child) { super.applyChildOptions(options, child); presenter.applyChildOptions(resolveCurrentOptions(), child); if (child instanceof ReactComponent) { fabOptionsPresenter.applyOptions(this.options.fabOptions, (ReactComponent) child, getView()); } performOnParentController(parentController -> ((ParentController) parentController).applyChildOptions( this.options.copy() .clearTopBarOptions() .clearAnimationOptions() .clearFabOptions() .clearTopTabOptions() .clearTopTabsOptions(), child ) ); } }
StackController extends ParentController<StackLayout> { @Override public void applyChildOptions(Options options, Component child) { super.applyChildOptions(options, child); presenter.applyChildOptions(resolveCurrentOptions(), child); if (child instanceof ReactComponent) { fabOptionsPresenter.applyOptions(this.options.fabOptions, (ReactComponent) child, getView()); } performOnParentController(parentController -> ((ParentController) parentController).applyChildOptions( this.options.copy() .clearTopBarOptions() .clearAnimationOptions() .clearFabOptions() .clearTopTabOptions() .clearTopTabsOptions(), child ) ); } StackController(Activity activity, List<ViewController> children, ChildControllersRegistry childRegistry, TopBarBackgroundViewController topBarBackgroundViewController, TopBarController topBarController, NavigationAnimator animator, String id, Options initialOptions, BackButtonHelper backButtonHelper, StackPresenter stackPresenter, Presenter presenter); }
StackController extends ParentController<StackLayout> { @Override public void applyChildOptions(Options options, Component child) { super.applyChildOptions(options, child); presenter.applyChildOptions(resolveCurrentOptions(), child); if (child instanceof ReactComponent) { fabOptionsPresenter.applyOptions(this.options.fabOptions, (ReactComponent) child, getView()); } performOnParentController(parentController -> ((ParentController) parentController).applyChildOptions( this.options.copy() .clearTopBarOptions() .clearAnimationOptions() .clearFabOptions() .clearTopTabOptions() .clearTopTabsOptions(), child ) ); } StackController(Activity activity, List<ViewController> children, ChildControllersRegistry childRegistry, TopBarBackgroundViewController topBarBackgroundViewController, TopBarController topBarController, NavigationAnimator animator, String id, Options initialOptions, BackButtonHelper backButtonHelper, StackPresenter stackPresenter, Presenter presenter); @Override void setDefaultOptions(Options defaultOptions); @Override void onAttachToParent(); @Override void mergeOptions(Options options); @Override void applyChildOptions(Options options, Component child); @Override void mergeChildOptions(Options options, ViewController childController, Component child); @Override void destroy(); @Override void clearOptions(); @Override void onChildDestroyed(Component child); void push(ViewController child, CommandListener listener); void setRoot(ViewController child, CommandListener listener); void pop(Options mergeOptions, CommandListener listener); void popTo(ViewController viewController, Options mergeOptions, CommandListener listener); void popToRoot(Options mergeOptions, CommandListener listener); int size(); boolean isEmpty(); @Override boolean handleBack(CommandListener listener); @Override void sendOnNavigationButtonPressed(String buttonId); @NonNull @Override Collection<ViewController> getChildControllers(); @Override void setupTopTabsWithViewPager(ViewPager viewPager); @Override void clearTopTabs(); @RestrictTo(RestrictTo.Scope.TESTS) TopBar getTopBar(); @RestrictTo(RestrictTo.Scope.TESTS) StackLayout getStackLayout(); }
StackController extends ParentController<StackLayout> { @Override public void applyChildOptions(Options options, Component child) { super.applyChildOptions(options, child); presenter.applyChildOptions(resolveCurrentOptions(), child); if (child instanceof ReactComponent) { fabOptionsPresenter.applyOptions(this.options.fabOptions, (ReactComponent) child, getView()); } performOnParentController(parentController -> ((ParentController) parentController).applyChildOptions( this.options.copy() .clearTopBarOptions() .clearAnimationOptions() .clearFabOptions() .clearTopTabOptions() .clearTopTabsOptions(), child ) ); } StackController(Activity activity, List<ViewController> children, ChildControllersRegistry childRegistry, TopBarBackgroundViewController topBarBackgroundViewController, TopBarController topBarController, NavigationAnimator animator, String id, Options initialOptions, BackButtonHelper backButtonHelper, StackPresenter stackPresenter, Presenter presenter); @Override void setDefaultOptions(Options defaultOptions); @Override void onAttachToParent(); @Override void mergeOptions(Options options); @Override void applyChildOptions(Options options, Component child); @Override void mergeChildOptions(Options options, ViewController childController, Component child); @Override void destroy(); @Override void clearOptions(); @Override void onChildDestroyed(Component child); void push(ViewController child, CommandListener listener); void setRoot(ViewController child, CommandListener listener); void pop(Options mergeOptions, CommandListener listener); void popTo(ViewController viewController, Options mergeOptions, CommandListener listener); void popToRoot(Options mergeOptions, CommandListener listener); int size(); boolean isEmpty(); @Override boolean handleBack(CommandListener listener); @Override void sendOnNavigationButtonPressed(String buttonId); @NonNull @Override Collection<ViewController> getChildControllers(); @Override void setupTopTabsWithViewPager(ViewPager viewPager); @Override void clearTopTabs(); @RestrictTo(RestrictTo.Scope.TESTS) TopBar getTopBar(); @RestrictTo(RestrictTo.Scope.TESTS) StackLayout getStackLayout();  }