Search in sources :

Example 1 with FabActionParams

use of com.reactnativenavigation.params.FabActionParams in project react-native-navigation by wix.

the class FloatingActionButtonCoordinator method createAction.

private FloatingActionButton createAction(int index) {
    final FabActionParams actionParams = params.actions.get(index);
    FloatingActionButton action = createFab(actionParams.icon);
    action.setLayoutParams(createActionLayoutParams(index));
    action.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NavigationApplication.instance.getEventEmitter().sendNavigatorEvent(actionParams.id, actionParams.navigatorEventId);
            fabAnimator.collapse();
        }
    });
    if (actionParams.backgroundColor.hasColor()) {
        action.setBackgroundTintList(ColorStateList.valueOf(actionParams.backgroundColor.getColor()));
    }
    action.setSize(FloatingActionButton.SIZE_MINI);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        action.setCompatElevation(0);
    }
    return action;
}
Also used : FabActionParams(com.reactnativenavigation.params.FabActionParams) FloatingActionButton(android.support.design.widget.FloatingActionButton) View(android.view.View)

Example 2 with FabActionParams

use of com.reactnativenavigation.params.FabActionParams in project react-native-navigation by wix.

the class FabActionParamsParser method parse.

public FabActionParams parse(Bundle params, String navigatorEventId) {
    FabActionParams fabActionParams = new FabActionParams();
    fabActionParams.id = params.getString("id");
    fabActionParams.navigatorEventId = navigatorEventId;
    fabActionParams.icon = ImageLoader.loadImage(params.getString("icon"));
    fabActionParams.backgroundColor = StyleParams.Color.parse(params, "backgroundColor");
    fabActionParams.iconColor = StyleParams.Color.parse(params, "iconColor");
    if (fabActionParams.iconColor.hasColor()) {
        ViewUtils.tintDrawable(fabActionParams.icon, fabActionParams.iconColor.getColor(), true);
    }
    return fabActionParams;
}
Also used : FabActionParams(com.reactnativenavigation.params.FabActionParams)

Aggregations

FabActionParams (com.reactnativenavigation.params.FabActionParams)2 FloatingActionButton (android.support.design.widget.FloatingActionButton)1 View (android.view.View)1