Skip to content

Commit e03f373

Browse files
committed
Change alpha relavant attributes names
1 parent bba7548 commit e03f373

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

colorpickerview/src/main/java/com/skydoves/colorpickerview/ColorPickerView.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ public class ColorPickerView extends FrameLayout implements LifecycleObserver {
8787
private ActionMode actionMode = ActionMode.ALWAYS;
8888

8989
@FloatRange(from = 0.0, to = 1.0)
90-
private float alpha_selector = 1.0f;
90+
private float selector_alpha = 1.0f;
9191

9292
@FloatRange(from = 0.0, to = 1.0)
93-
private float alpha_flag = 1.0f;
93+
private float flag_alpha = 1.0f;
9494

9595
@Px private int selectorSize = 0;
9696

@@ -135,16 +135,16 @@ private void getAttrs(AttributeSet attrs) {
135135
this.selectorDrawable = AppCompatResources.getDrawable(getContext(), resourceId);
136136
}
137137
}
138-
if (a.hasValue(R.styleable.ColorPickerView_alpha_selector)) {
139-
this.alpha_selector =
140-
a.getFloat(R.styleable.ColorPickerView_alpha_selector, alpha_selector);
138+
if (a.hasValue(R.styleable.ColorPickerView_selector_alpha)) {
139+
this.selector_alpha =
140+
a.getFloat(R.styleable.ColorPickerView_selector_alpha, selector_alpha);
141141
}
142142
if (a.hasValue(R.styleable.ColorPickerView_selector_size)) {
143143
this.selectorSize =
144144
a.getDimensionPixelSize(R.styleable.ColorPickerView_selector_size, selectorSize);
145145
}
146-
if (a.hasValue(R.styleable.ColorPickerView_alpha_flag)) {
147-
this.alpha_flag = a.getFloat(R.styleable.ColorPickerView_alpha_flag, alpha_flag);
146+
if (a.hasValue(R.styleable.ColorPickerView_flag_alpha)) {
147+
this.flag_alpha = a.getFloat(R.styleable.ColorPickerView_flag_alpha, flag_alpha);
148148
}
149149
if (a.hasValue(R.styleable.ColorPickerView_actionMode)) {
150150
int actionMode = a.getInteger(R.styleable.ColorPickerView_actionMode, 0);
@@ -193,7 +193,7 @@ private void onCreate() {
193193
}
194194
selectorParam.gravity = Gravity.CENTER;
195195
addView(selector, selectorParam);
196-
selector.setAlpha(alpha_selector);
196+
selector.setAlpha(selector_alpha);
197197

198198
getViewTreeObserver()
199199
.addOnGlobalLayoutListener(
@@ -260,8 +260,8 @@ protected void onCreateByBuilder(Builder builder) {
260260

261261
this.paletteDrawable = builder.paletteDrawable;
262262
this.selectorDrawable = builder.selectorDrawable;
263-
this.alpha_selector = builder.alpha_selector;
264-
this.alpha_flag = builder.alpha_flag;
263+
this.selector_alpha = builder.alpha_selector;
264+
this.flag_alpha = builder.alpha_flag;
265265
this.selectorSize = builder.selectorSize;
266266
this.debounceDuration = builder.debounceDuration;
267267
onCreate();
@@ -429,10 +429,10 @@ public void fireColorListener(@ColorInt int color, final boolean fromUser) {
429429
if (VISIBLE_FLAG) {
430430
VISIBLE_FLAG = false;
431431
if (this.selector != null) {
432-
this.selector.setAlpha(alpha_selector);
432+
this.selector.setAlpha(selector_alpha);
433433
}
434434
if (this.flagView != null) {
435-
this.flagView.setAlpha(alpha_flag);
435+
this.flagView.setAlpha(flag_alpha);
436436
}
437437
}
438438
}
@@ -548,7 +548,7 @@ public void setFlagView(@NonNull FlagView flagView) {
548548
flagView.gone();
549549
addView(flagView);
550550
this.flagView = flagView;
551-
flagView.setAlpha(alpha_flag);
551+
flagView.setAlpha(flag_alpha);
552552
}
553553

554554
/**
@@ -775,11 +775,11 @@ public void setPaletteDrawable(Drawable drawable) {
775775
if (!VISIBLE_FLAG) {
776776
VISIBLE_FLAG = true;
777777
if (selector != null) {
778-
alpha_selector = selector.getAlpha();
778+
selector_alpha = selector.getAlpha();
779779
selector.setAlpha(0.0f);
780780
}
781781
if (flagView != null) {
782-
alpha_flag = flagView.getAlpha();
782+
flag_alpha = flagView.getAlpha();
783783
flagView.setAlpha(0.0f);
784784
}
785785
}

colorpickerview/src/main/res/values/attrs_colorpicker.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
<!-- sets a width/height square size of the selector. -->
99
<attr name="selector_size" format="dimension" />
1010
<!-- sets an alpha of thr selector. -->
11-
<attr name="alpha_selector" format="float" />
11+
<attr name="selector_alpha" format="float" />
1212
<!-- sets an alpha of the flag. -->
13-
<attr name="alpha_flag" format="float" />
13+
<attr name="flag_alpha" format="float" />
14+
<!-- sets a is flip-able or not of the flag. -->
15+
<attr name="flag_isFlipAble" format="boolean" />
1416
<!-- sets a preference name for persisting and restoring status of the selector and slideBars. -->
1517
<attr name="preferenceName" format="string" />
1618
<!-- sets a debounce duration of the invoking color listener. -->

0 commit comments

Comments
 (0)