Skip to content

Commit

Permalink
Add enable brightness support for popup #5
Browse files Browse the repository at this point in the history
  • Loading branch information
duanhong169 committed Sep 25, 2018
1 parent b3fa0b5 commit 41ea5e6
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class ColorPickerPopup {

private Context context;
private int initialColor;
private boolean enableBrightness;
private boolean enableAlpha;
private String okTitle;
private String cancelTitle;
Expand All @@ -29,6 +30,7 @@ public class ColorPickerPopup {
private ColorPickerPopup(Builder builder) {
this.context = builder.context;
this.initialColor = builder.initialColor;
this.enableBrightness = builder.enableBrightness;
this.enableAlpha = builder.enableAlpha;
this.okTitle = builder.okTitle;
this.cancelTitle = builder.cancelTitle;
Expand All @@ -52,6 +54,7 @@ public void show(View parent, final ColorPickerObserver observer) {
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
popupWindow.setOutsideTouchable(true);
colorPickerView.setInitialColor(initialColor);
colorPickerView.setEnabledBrightness(enableBrightness);
colorPickerView.setEnabledAlpha(enableAlpha);
colorPickerView.subscribe(observer);
TextView cancel = layout.findViewById(R.id.cancel);
Expand Down Expand Up @@ -105,6 +108,7 @@ public static class Builder {

private Context context;
private int initialColor = Color.MAGENTA;
private boolean enableBrightness = true;
private boolean enableAlpha = false;
private String okTitle = "OK";
private String cancelTitle = "Cancel";
Expand All @@ -120,6 +124,12 @@ public Builder initialColor(int color) {
return this;
}

public Builder enableBrightness(boolean enable) {
enableBrightness = enable;
return this;
}


public Builder enableAlpha(boolean enable) {
enableAlpha = enable;
return this;
Expand Down

0 comments on commit 41ea5e6

Please sign in to comment.