Search in sources :

Example 1 with FabOptions

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;
}
Also used : FabOptions(com.reactnativenavigation.options.FabOptions) Options(com.reactnativenavigation.options.Options) FabOptions(com.reactnativenavigation.options.FabOptions) Text(com.reactnativenavigation.options.params.Text) NonNull(androidx.annotation.NonNull)

Example 2 with FabOptions

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();
    }
}
Also used : FabOptions(com.reactnativenavigation.options.FabOptions) Fab(com.reactnativenavigation.views.stack.fab.Fab)

Example 3 with FabOptions

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();
    }
}
Also used : FabOptions(com.reactnativenavigation.options.FabOptions) Fab(com.reactnativenavigation.views.stack.fab.Fab)

Example 4 with FabOptions

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;
}
Also used : FabOptions(com.reactnativenavigation.options.FabOptions) Options(com.reactnativenavigation.options.Options) FabOptions(com.reactnativenavigation.options.FabOptions) Text(com.reactnativenavigation.options.params.Text) NonNull(androidx.annotation.NonNull)

Aggregations

FabOptions (com.reactnativenavigation.options.FabOptions)4 NonNull (androidx.annotation.NonNull)2 Options (com.reactnativenavigation.options.Options)2 Text (com.reactnativenavigation.options.params.Text)2 Fab (com.reactnativenavigation.views.stack.fab.Fab)2