imagepicker/src/main/java/com/rxxb/imagepicker/util/CornerUtils.java
/**
     * set btn selector with corner drawable for special position
     */
set btn selector with corner drawable for special position
set btn selector with corner drawable for special position
public static StateListDrawable btnSelector(float radius, int normalColor, int pressColor, int enableColor, int position) {
        StateListDrawable bg = new StateListDrawable();
        Drawable normal = null;
        Drawable pressed = null;
        Drawable enabled = null;
        if (position == 0) {
            normal = cornerDrawable(normalColor, new float[]{0, 0, 0, 0, 0, 0, radius, radius});
            pressed = cornerDrawable(pressColor, new float[]{0, 0, 0, 0, 0, 0, radius, radius});
            enabled = cornerDrawable(enableColor, new float[]{0, 0, 0, 0, 0, 0, radius, radius});
        } else if (position == 1) {
            normal = cornerDrawable(normalColor, new float[]{0, 0, 0, 0, radius, radius, 0, 0});
            pressed = cornerDrawable(pressColor, new float[]{0, 0, 0, 0, radius, radius, 0, 0});
            enabled = cornerDrawable(enableColor, new float[]{0, 0, 0, 0, radius, radius, 0, 0});
        } else if (position == -1) {
            normal = cornerDrawable(normalColor, new float[]{0, 0, 0, 0, radius, radius, radius, radius});
            pressed = cornerDrawable(pressColor, new float[]{0, 0, 0, 0, radius, radius, radius, radius});
            enabled = cornerDrawable(enableColor, new float[]{0, 0, 0, 0, radius, radius, radius, radius});
        } else if (position == -2) {
            normal = cornerDrawable(normalColor, radius);
            pressed = cornerDrawable(pressColor, radius);
            enabled = cornerDrawable(enableColor, radius);
        }
        bg.addState(new int[]{-android.R.attr.state_pressed}, normal);
        bg.addState(new int[]{android.R.attr.state_pressed}, pressed);
        bg.addState(new int[]{android.R.attr.state_enabled}, enabled);
        return bg;
    }
public static StateListDrawable btnSelector ( float radius , int normalColor , int pressColor , int enableColor , int position ) { StateListDrawable bg = new StateListDrawable ( ) ; Drawable normal = null ; Drawable pressed = null ; Drawable enabled = null ; if ( position == 0 ) { normal = cornerDrawable ( normalColor , new float [ ] { 0 , 0 , 0 , 0 , 0 , 0 , radius , radius } ) ; pressed = cornerDrawable ( pressColor , new float [ ] { 0 , 0 , 0 , 0 , 0 , 0 , radius , radius } ) ; enabled = cornerDrawable ( enableColor , new float [ ] { 0 , 0 , 0 , 0 , 0 , 0 , radius , radius } ) ; } else if ( position == 1 ) { normal = cornerDrawable ( normalColor , new float [ ] { 0 , 0 , 0 , 0 , radius , radius , 0 , 0 } ) ; pressed = cornerDrawable ( pressColor , new float [ ] { 0 , 0 , 0 , 0 , radius , radius , 0 , 0 } ) ; enabled = cornerDrawable ( enableColor , new float [ ] { 0 , 0 , 0 , 0 , radius , radius , 0 , 0 } ) ; } else if ( position == - 1 ) { normal = cornerDrawable ( normalColor , new float [ ] { 0 , 0 , 0 , 0 , radius , radius , radius , radius } ) ; pressed = cornerDrawable ( pressColor , new float [ ] { 0 , 0 , 0 , 0 , radius , radius , radius , radius } ) ; enabled = cornerDrawable ( enableColor , new float [ ] { 0 , 0 , 0 , 0 , radius , radius , radius , radius } ) ; } else if ( position == - 2 ) { normal = cornerDrawable ( normalColor , radius ) ; pressed = cornerDrawable ( pressColor , radius ) ; enabled = cornerDrawable ( enableColor , radius ) ; } bg . addState ( new int [ ] { - android . R . attr . state_pressed } , normal ) ; bg . addState ( new int [ ] { android . R . attr . state_pressed } , pressed ) ; bg . addState ( new int [ ] { android . R . attr . state_enabled } , enabled ) ; return bg ; }
set btn selector with corner drawable for special position
set btn selector with corner drawable for special position
// left btn // right btn // only one btn // for material dialog