@@ -92,6 +92,8 @@ public class ColorPickerView extends FrameLayout implements LifecycleObserver {
92
92
@ FloatRange (from = 0.0 , to = 1.0 )
93
93
private float flag_alpha = 1.0f ;
94
94
95
+ private boolean flag_isFlipAble = true ;
96
+
95
97
@ Px private int selectorSize = 0 ;
96
98
97
99
private boolean VISIBLE_FLAG = false ;
@@ -146,6 +148,10 @@ private void getAttrs(AttributeSet attrs) {
146
148
if (a .hasValue (R .styleable .ColorPickerView_flag_alpha )) {
147
149
this .flag_alpha = a .getFloat (R .styleable .ColorPickerView_flag_alpha , flag_alpha );
148
150
}
151
+ if (a .hasValue (R .styleable .ColorPickerView_flag_isFlipAble )) {
152
+ this .flag_isFlipAble =
153
+ a .getBoolean (R .styleable .ColorPickerView_flag_isFlipAble , flag_isFlipAble );
154
+ }
149
155
if (a .hasValue (R .styleable .ColorPickerView_actionMode )) {
150
156
int actionMode = a .getInteger (R .styleable .ColorPickerView_actionMode , 0 );
151
157
if (actionMode == 0 ) {
@@ -260,8 +266,8 @@ protected void onCreateByBuilder(Builder builder) {
260
266
261
267
this .paletteDrawable = builder .paletteDrawable ;
262
268
this .selectorDrawable = builder .selectorDrawable ;
263
- this .selector_alpha = builder .alpha_selector ;
264
- this .flag_alpha = builder .alpha_flag ;
269
+ this .selector_alpha = builder .selector_alpha ;
270
+ this .flag_alpha = builder .flag_alpha ;
265
271
this .selectorSize = builder .selectorSize ;
266
272
this .debounceDuration = builder .debounceDuration ;
267
273
onCreate ();
@@ -549,6 +555,7 @@ public void setFlagView(@NonNull FlagView flagView) {
549
555
addView (flagView );
550
556
this .flagView = flagView ;
551
557
flagView .setAlpha (flag_alpha );
558
+ flagView .setFlipAble (flag_isFlipAble );
552
559
}
553
560
554
561
/**
@@ -959,10 +966,12 @@ public static class Builder {
959
966
@ ColorInt private int initialColor = 0 ;
960
967
961
968
@ FloatRange (from = 0.0 , to = 1.0 )
962
- private float alpha_selector = 1.0f ;
969
+ private float selector_alpha = 1.0f ;
963
970
964
971
@ FloatRange (from = 0.0 , to = 1.0 )
965
- private float alpha_flag = 1.0f ;
972
+ private float flag_alpha = 1.0f ;
973
+
974
+ private boolean flag_isFlipAble = false ;
966
975
967
976
@ Dp private int selectorSize = 0 ;
968
977
@ Dp private int width = LayoutParams .MATCH_PARENT ;
@@ -1015,12 +1024,17 @@ public Builder setActionMode(ActionMode actionMode) {
1015
1024
}
1016
1025
1017
1026
public Builder setSelectorAlpha (@ FloatRange (from = 0.0 , to = 1.0 ) float alpha ) {
1018
- this .alpha_selector = alpha ;
1027
+ this .selector_alpha = alpha ;
1019
1028
return this ;
1020
1029
}
1021
1030
1022
1031
public Builder setFlagAlpha (@ FloatRange (from = 0.0 , to = 1.0 ) float alpha ) {
1023
- this .alpha_flag = alpha ;
1032
+ this .flag_alpha = alpha ;
1033
+ return this ;
1034
+ }
1035
+
1036
+ public Builder setFlagIsFlipAble (boolean isFlipAble ) {
1037
+ this .flag_isFlipAble = isFlipAble ;
1024
1038
return this ;
1025
1039
}
1026
1040
0 commit comments