use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class StackPresenter method getTopBarTopMargin.
private int getTopBarTopMargin(StackController stack, ViewController<?> child) {
Options withDefault = stack.resolveChildOptions(child).withDefaultOptions(defaultOptions);
int topMargin = UiUtils.dpToPx(activity, withDefault.topBar.topMargin.get(0));
int statusBarInset = withDefault.statusBar.visible.isTrueOrUndefined() && !withDefault.statusBar.drawBehind.isTrue() ? SystemUiUtils.getStatusBarHeight(child.getActivity()) : 0;
return topMargin + statusBarInset;
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class Presenter method onConfigurationChanged.
public void onConfigurationChanged(ViewController controller, Options options) {
Options withDefault = options.withDefaultOptions(defaultOptions);
setNavigationBarBackgroundColor(withDefault.navigationBar);
setStatusBarBackgroundColor(withDefault.statusBar);
setTextColorScheme(withDefault.statusBar);
applyBackgroundColor(controller, withDefault);
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class Presenter method mergeOptions.
public void mergeOptions(ViewController<?> viewController, Options options) {
final Options withDefaults = viewController.resolveCurrentOptions().copy().mergeWith(options).withDefaultOptions(defaultOptions);
mergeStatusBarOptions(viewController.getView(), withDefaults.statusBar);
mergeNavigationBarOptions(withDefaults.navigationBar);
applyLayoutInsetsOnMostTopParent(viewController, withDefaults.layout.getInsets());
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class ModalPresenter method dismissModal.
void dismissModal(ViewController<?> toDismiss, @Nullable ViewController<?> toAdd, ViewController<?> root, CommandListener listener) {
if (modalsLayout == null) {
listener.onError("Can not dismiss modal before activity is created");
return;
}
if (toAdd != null) {
toAdd.attachView(toAdd == root ? rootLayout : modalsLayout, 0);
toAdd.onViewDidAppear();
}
Options options = toDismiss.resolveCurrentOptions(defaultOptions);
if (options.animations.dismissModal.getExit().enabled.isTrueOrUndefined()) {
modalAnimator.dismiss(toAdd, toDismiss, options.animations.dismissModal, new ScreenAnimationListener() {
@Override
public void onEnd() {
onDismissEnd(toDismiss, listener);
}
});
} else {
onDismissEnd(toDismiss, listener);
}
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class PresenterTest method shouldMergeInsetsOnTopMostParent.
@Test
public void shouldMergeInsetsOnTopMostParent() {
final ViewGroup spy = Mockito.mock(ViewGroup.class);
Mockito.when(spy.getLayoutParams()).thenReturn(new ViewGroup.LayoutParams(0, 0));
Mockito.when(controller.getView()).thenReturn(spy);
Mockito.when(controller.resolveCurrentOptions()).thenReturn(Options.EMPTY);
Options options = new Options();
options.layout.setInsets(new LayoutInsets(1, 2, 3, 4));
uut.mergeOptions(controller, options);
verify(parentView).setPadding(2, 1, 4, 3);
}
Aggregations