use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class StackPresenter method applyChildOptions.
public void applyChildOptions(Options currentChildOptions, StackController stack, ViewController<?> child) {
Options finalChildOptions = currentChildOptions.copy().withDefaultOptions(defaultOptions);
applyOrientation(finalChildOptions.layout.orientation);
applyButtons(finalChildOptions.topBar, child);
applyTopBarOptions(finalChildOptions, stack, child);
applyTopTabsOptions(finalChildOptions.topTabs);
applyTopTabOptions(finalChildOptions.topTabOptions);
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class StackPresenter method onConfigurationChanged.
public void onConfigurationChanged(Options options) {
if (topBar == null)
return;
Options withDefault = options.copy().withDefaultOptions(defaultOptions);
if (currentRightButtons != null && !currentRightButtons.isEmpty())
topBarController.applyRightButtons(currentRightButtons);
if (currentLeftButtons != null && !currentLeftButtons.isEmpty())
topBarController.applyLeftButtons(currentLeftButtons);
if (withDefault.topBar.buttons.back.visible.isTrue()) {
topBar.setBackButton(createButtonController(withDefault.topBar.buttons.back));
}
topBar.setOverflowButtonColor(withDefault.topBar.rightButtonColor.get(Color.BLACK));
topBar.applyTopTabsColors(withDefault.topTabs.selectedTabColor, withDefault.topTabs.unselectedTabColor);
topBar.setBorderColor(withDefault.topBar.borderColor.get(DEFAULT_BORDER_COLOR));
topBar.setBackgroundColor(withDefault.topBar.background.color.get(Color.WHITE));
topBar.setTitleTextColor(withDefault.topBar.title.color.get(TopBar.DEFAULT_TITLE_COLOR));
topBar.setSubtitleColor(withDefault.topBar.subtitle.color.get(TopBar.DEFAULT_TITLE_COLOR));
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class TestUtils method newStackController.
public static StackControllerBuilder newStackController(Activity activity) {
TopBarController topBarController = new TopBarController() {
@Override
protected TopBar createTopBar(@NonNull Context context, @NonNull StackLayout stackLayout) {
TopBar topBar = super.createTopBar(context, stackLayout);
topBar.layout(0, 0, 1000, UiUtils.getTopBarHeight(context));
return topBar;
}
};
return new StackControllerBuilder(activity, Mockito.mock(EventEmitter.class)).setId("stack" + CompatUtils.generateViewId()).setChildRegistry(new ChildControllersRegistry()).setTopBarController(topBarController).setStackPresenter(new StackPresenter(activity, new TitleBarReactViewCreatorMock(), new TopBarBackgroundViewCreatorMock(), new TitleBarButtonCreatorMock(), new IconResolver(activity, new ImageLoader()), new TypefaceLoaderMock(), new RenderChecker(), new Options())).setInitialOptions(new Options());
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class PresenterTest method shouldApplyInsetsOnTopMostParent.
@Test
public void shouldApplyInsetsOnTopMostParent() {
final ViewGroup spy = Mockito.mock(ViewGroup.class);
Mockito.when(spy.getLayoutParams()).thenReturn(new ViewGroup.LayoutParams(0, 0));
Mockito.when(controller.getView()).thenReturn(spy);
Options options = new Options();
options.layout.setInsets(new LayoutInsets(1, 2, 3, 4));
uut.applyOptions(controller, options);
verify(parentView).setPadding(2, 1, 4, 3);
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class PresenterTest method mergeStatusBarVisible_callsShowHide.
@Test
public void mergeStatusBarVisible_callsShowHide() {
mockSystemUiUtils(1, 1, (mockedStatic) -> {
ViewGroup spy = spy(new FrameLayout(activity));
Mockito.when(controller.getView()).thenReturn(spy);
Mockito.when(controller.resolveCurrentOptions()).thenReturn(Options.EMPTY);
Options options = new Options();
options.statusBar.visible = new Bool(false);
uut.mergeOptions(controller, options);
mockedStatic.verify(() -> SystemUiUtils.hideStatusBar(any(), eq(spy)), times(1));
options.statusBar.visible = new Bool(true);
uut.mergeOptions(controller, options);
mockedStatic.verify(() -> SystemUiUtils.showStatusBar(any(), eq(spy)), times(1));
});
}
Aggregations