Search in sources :

Example 11 with Presenter

use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.

the class ParentControllerTest method beforeEach.

@Override
public void beforeEach() {
    super.beforeEach();
    activity = newActivity();
    childRegistry = new ChildControllersRegistry();
    children = new ArrayList<>();
    Options initialOptions = new Options();
    initialOptions.topBar.title.text = new Text(INITIAL_TITLE);
    presenter = spy(new Presenter(activity, new Options()));
    uut = spy(new ParentController<ViewGroup>(activity, childRegistry, "uut", presenter, initialOptions) {

        @Override
        public ViewController<?> getCurrentChild() {
            return children.get(0);
        }

        @NonNull
        @Override
        public ViewGroup createView() {
            FrameLayout layout = new FrameLayout(activity);
            for (ViewController<?> child : children) {
                child.setParentController(this);
                layout.addView(child.getView());
            }
            return layout;
        }

        @Override
        public void sendOnNavigationButtonPressed(String buttonId) {
        }

        @NonNull
        @Override
        public Collection<ViewController<?>> getChildControllers() {
            return children;
        }
    });
}
Also used : Options(com.reactnativenavigation.options.Options) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) ViewController(com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController) Presenter(com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter) FrameLayout(android.widget.FrameLayout) ChildControllersRegistry(com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry) Text(com.reactnativenavigation.options.params.Text)

Example 12 with Presenter

use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.

the class LayoutFactory method createBottomTabs.

private ViewController<?> createBottomTabs(LayoutNode node) {
    List<ViewController<?>> tabs = map(node.children, this::create);
    BottomTabsPresenter bottomTabsPresenter = new BottomTabsPresenter(tabs, defaultOptions, new BottomTabsAnimator());
    return new BottomTabsController(activity, tabs, childRegistry, eventEmitter, new ImageLoader(), node.id, parseOptions(node.getOptions()), new Presenter(activity, defaultOptions), new BottomTabsAttacher(tabs, bottomTabsPresenter, defaultOptions), bottomTabsPresenter, new BottomTabPresenter(activity, tabs, new ImageLoader(), new TypefaceLoader(activity), defaultOptions));
}
Also used : BottomTabsController(com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController) BottomTabPresenter(com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabPresenter) ComponentViewController(com.reactnativenavigation.viewcontrollers.component.ComponentViewController) ViewController(com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController) ExternalComponentViewController(com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentViewController) StackPresenter(com.reactnativenavigation.viewcontrollers.stack.StackPresenter) BottomTabPresenter(com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabPresenter) BottomTabsPresenter(com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsPresenter) SideMenuPresenter(com.reactnativenavigation.viewcontrollers.sidemenu.SideMenuPresenter) Presenter(com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter) ExternalComponentPresenter(com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentPresenter) ComponentPresenter(com.reactnativenavigation.viewcontrollers.component.ComponentPresenter) TypefaceLoader(com.reactnativenavigation.options.parsers.TypefaceLoader) BottomTabsPresenter(com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsPresenter) BottomTabsAttacher(com.reactnativenavigation.viewcontrollers.bottomtabs.attacher.BottomTabsAttacher) ImageLoader(com.reactnativenavigation.utils.ImageLoader) BottomTabsAnimator(com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsAnimator)

Example 13 with Presenter

use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.

the class ChildControllerTest method beforeEach.

@Override
public void beforeEach() {
    childRegistry = spy(new ChildControllersRegistry());
    presenter = Mockito.mock(Presenter.class);
    uut = new SimpleViewController(newActivity(), childRegistry, "childId", presenter, new Options()) {

        @Override
        public Options resolveCurrentOptions() {
            return resolvedOptions;
        }
    };
    ParentController<?> parent = Mockito.mock(ParentController.class);
    Mockito.when(parent.resolveChildOptions(uut)).thenReturn(Options.EMPTY);
    uut.setParentController(parent);
}
Also used : Options(com.reactnativenavigation.options.Options) Presenter(com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController)

Aggregations

Presenter (com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter)13 Options (com.reactnativenavigation.options.Options)8 ComponentPresenter (com.reactnativenavigation.viewcontrollers.component.ComponentPresenter)7 ChildControllersRegistry (com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry)6 ComponentViewController (com.reactnativenavigation.viewcontrollers.component.ComponentViewController)5 ViewController (com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController)5 BottomTabPresenter (com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabPresenter)4 BottomTabsPresenter (com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsPresenter)4 ExternalComponentPresenter (com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentPresenter)4 SideMenuPresenter (com.reactnativenavigation.viewcontrollers.sidemenu.SideMenuPresenter)4 StackPresenter (com.reactnativenavigation.viewcontrollers.stack.StackPresenter)4 SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)3 ExternalComponentViewController (com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentViewController)3 TestComponentLayout (com.reactnativenavigation.mocks.TestComponentLayout)2 TestReactView (com.reactnativenavigation.mocks.TestReactView)2 Bool (com.reactnativenavigation.options.params.Bool)2 Text (com.reactnativenavigation.options.params.Text)2 TopTabsLayoutCreator (com.reactnativenavigation.views.toptabs.TopTabsLayoutCreator)2 ArrayList (java.util.ArrayList)2 Activity (android.app.Activity)1