use of com.reactnativenavigation.options.FabOptions in project react-native-navigation by wix.
the class FloatingActionButtonTest method getOptionsWithFab.
@NonNull
private Options getOptionsWithFab() {
Options options = new Options();
FabOptions fabOptions = new FabOptions();
fabOptions.id = new Text("FAB");
options.fabOptions = fabOptions;
return options;
}
use of com.reactnativenavigation.options.FabOptions in project react-native-navigation by wix.
the class FabPresenter method applyFabMenuOptions.
private void applyFabMenuOptions(ViewController<?> component, FabMenu fabMenu, FabOptions options) {
if (options.visible.isTrueOrUndefined()) {
fabMenu.showMenuButton(true);
}
if (options.visible.isFalse()) {
fabMenu.hideMenuButton(true);
}
if (options.backgroundColor.hasValue()) {
fabMenu.setMenuButtonColorNormal(options.backgroundColor.get());
}
if (options.clickColor.hasValue()) {
fabMenu.setMenuButtonColorPressed(options.clickColor.get());
}
if (options.rippleColor.hasValue()) {
fabMenu.setMenuButtonColorRipple(options.rippleColor.get());
}
for (Fab fabStored : fabMenu.getActions()) {
fabMenu.removeMenuButton(fabStored);
}
fabMenu.getActions().clear();
for (FabOptions fabOption : options.actionsArray) {
Fab fab = new Fab(viewGroup.getContext(), fabOption.id.get());
applyFabOptions(component, fab, fabOption);
fab.setOnClickListener(v -> component.sendOnNavigationButtonPressed(options.id.get()));
fabMenu.getActions().add(fab);
fabMenu.addMenuButton(fab);
}
if (options.hideOnScroll.isTrue()) {
fabMenu.enableCollapse(component.getScrollEventListener());
}
if (options.hideOnScroll.isFalseOrUndefined()) {
fabMenu.disableCollapse();
}
}
use of com.reactnativenavigation.options.FabOptions in project react-native-navigation by wix.
the class FabPresenter method mergeFabMenuOptions.
private void mergeFabMenuOptions(ViewController<?> component, FabMenu fabMenu, FabOptions options) {
if (options.visible.isTrue()) {
fabMenu.showMenuButton(true);
}
if (options.visible.isFalse()) {
fabMenu.hideMenuButton(true);
}
if (options.backgroundColor.hasValue()) {
fabMenu.setMenuButtonColorNormal(options.backgroundColor.get());
}
if (options.clickColor.hasValue()) {
fabMenu.setMenuButtonColorPressed(options.clickColor.get());
}
if (options.rippleColor.hasValue()) {
fabMenu.setMenuButtonColorRipple(options.rippleColor.get());
}
if (options.actionsArray.size() > 0) {
for (Fab fabStored : fabMenu.getActions()) {
fabMenu.removeMenuButton(fabStored);
}
fabMenu.getActions().clear();
for (FabOptions fabOption : options.actionsArray) {
Fab fab = new Fab(viewGroup.getContext(), fabOption.id.get());
applyFabOptions(component, fab, fabOption);
fab.setOnClickListener(v -> component.sendOnNavigationButtonPressed(options.id.get()));
fabMenu.getActions().add(fab);
fabMenu.addMenuButton(fab);
}
}
if (options.hideOnScroll.isTrue()) {
fabMenu.enableCollapse(component.getScrollEventListener());
}
if (options.hideOnScroll.isFalse()) {
fabMenu.disableCollapse();
}
}
use of com.reactnativenavigation.options.FabOptions in project react-native-navigation by wix.
the class FloatingActionButtonTest method getOptionsWithFabActions.
@NonNull
private Options getOptionsWithFabActions() {
Options options = new Options();
FabOptions fabOptions = new FabOptions();
fabOptions.id = new Text("FAB");
for (int i = 0; i < CHILD_FAB_COUNT; i++) {
FabOptions childOptions = new FabOptions();
childOptions.id = new Text("fab" + i);
fabOptions.actionsArray.add(childOptions);
}
options.fabOptions = fabOptions;
return options;
}
Aggregations