use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.
the class TopTabsViewControllerTest method createTabsControllers.
private List<ViewController<?>> createTabsControllers(Activity activity, List<Options> tabOptions) {
List<ViewController<?>> tabControllers = new ArrayList<>(SIZE);
for (int i = 0; i < SIZE; i++) {
ComponentViewController viewController = new ComponentViewController(activity, childRegistry, "idTab" + i, "theComponentName", new TestComponentViewCreator(), tabOptions.get(i), new Presenter(activity, new Options()), new ComponentPresenter(Options.EMPTY));
tabControllers.add(spy(viewController));
}
return tabControllers;
}
use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.
the class PresenterTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
activity = newActivity();
controller = mock(ViewController.class);
parentView = mock(ViewGroup.class);
parentController = Mocks.INSTANCE.parentController(null, parentView);
controller.setParentController((ParentController) parentController);
Mockito.when(controller.getTopMostParent()).thenReturn(parentController);
uut = new Presenter(activity, Options.EMPTY);
}
use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.
the class LayoutFactory method createTopTabs.
private ViewController<?> createTopTabs(LayoutNode node) {
final List<ViewController<?>> tabs = new ArrayList<>();
for (int i = 0; i < node.children.size(); i++) {
ViewController<?> tabController = create(node.children.get(i));
Options options = parseOptions(node.children.get(i).getOptions());
options.setTopTabIndex(i);
tabs.add(tabController);
}
return new TopTabsController(activity, childRegistry, node.id, tabs, new TopTabsLayoutCreator(activity, tabs), parseOptions(node.getOptions()), new Presenter(activity, defaultOptions));
}
use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.
the class LayoutFactory method createSideMenuRoot.
private ViewController<?> createSideMenuRoot(LayoutNode node) {
SideMenuController sideMenuController = new SideMenuController(activity, childRegistry, node.id, parseOptions(node.getOptions()), new SideMenuPresenter(), new Presenter(activity, defaultOptions));
ViewController<?> childControllerCenter = null, childControllerLeft = null, childControllerRight = null;
for (LayoutNode child : node.children) {
switch(child.type) {
case SideMenuCenter:
childControllerCenter = create(child);
childControllerCenter.setParentController(sideMenuController);
break;
case SideMenuLeft:
childControllerLeft = create(child);
childControllerLeft.setParentController(sideMenuController);
break;
case SideMenuRight:
childControllerRight = create(child);
childControllerRight.setParentController(sideMenuController);
break;
default:
throw new IllegalArgumentException("Invalid node type in sideMenu: " + node.type);
}
}
if (childControllerCenter != null) {
sideMenuController.setCenterController(childControllerCenter);
}
if (childControllerLeft != null) {
sideMenuController.setLeftController(childControllerLeft);
}
if (childControllerRight != null) {
sideMenuController.setRightController(childControllerRight);
}
return sideMenuController;
}
use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.
the class LayoutFactory method createComponent.
private ViewController<?> createComponent(LayoutNode node) {
String id = node.id;
String name = node.data.optString("name");
return new ComponentViewController(activity, childRegistry, id, name, new ComponentViewCreator(reactInstanceManager), parseOptions(node.getOptions()), new Presenter(activity, defaultOptions), new ComponentPresenter(defaultOptions));
}
Aggregations