private Drawable createStateListBackgroundDrawable() {
        StateListDrawable drawable = new StateListDrawable();

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            drawable.addState(new int[]{android.R.attr.state_enabled, android.R.attr.state_pressed},
                    createPressedBackgroundDrawable());
        }

        drawable.addState(new int[]{android.R.attr.state_enabled, android.R.attr.state_activated},
                createActivatedBackgroundDrawable());
        drawable.addState(new int[]{android.R.attr.state_enabled},
                createBackgroundDrawable(getColor()));
        drawable.addState(new int[]{}, createDisabledBackgroundDrawable());
        return drawable;
    }
private Drawable createStateListBackgroundDrawable() {
        StateListDrawable drawable = new StateListDrawable();

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            drawable.addState(new int[]{android.R.attr.state_enabled, android.R.attr.state_pressed},
                    createPressedBackgroundDrawable());
        }

        drawable.addState(new int[]{android.R.attr.state_enabled, android.R.attr.state_activated},
                createActivatedBackgroundDrawable());
        drawable.addState(new int[]{android.R.attr.state_enabled},
                createBackgroundDrawable(getColor()));
        drawable.addState(new int[]{}, createDisabledBackgroundDrawable());
        return drawable;
    }
private Drawable createStateListBackgroundDrawable ( ) { StateListDrawable drawable = new StateListDrawable ( ) ; if ( Build . VERSION . SDK_INT < Build . VERSION_CODES . LOLLIPOP ) { drawable . addState ( new int [ ] { android . R . attr . state_enabled , android . R . attr . state_pressed } , createPressedBackgroundDrawable ( ) ) ; } drawable . addState ( new int [ ] { android . R . attr . state_enabled , android . R . attr . state_activated } , createActivatedBackgroundDrawable ( ) ) ; drawable . addState ( new int [ ] { android . R . attr . state_enabled } , createBackgroundDrawable ( getColor ( ) ) ) ; drawable . addState ( new int [ ] { } , createDisabledBackgroundDrawable ( ) ) ; return drawable ; }
Creates and returns a state list drawable, which can be used as the floating action button
background and adapts the background color depending on the button's current state.

@return The drawable, which has been created, as an instance of the class {@link Drawable}
Creates and returns a state list drawable which can be used as the floating action button background and adapts the background color depending on the button s current state .