Skip to content

Commit

Permalink
Additional constructor to handle single value color.
Browse files Browse the repository at this point in the history
  • Loading branch information
mr5z authored Oct 15, 2020
1 parent e0e6a7e commit f0eef58
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,23 @@ public ColorPicker(Activity activity,
this.green = assertColorValueInRange(green);
this.blue = assertColorValueInRange(blue);
}

/**
* Creator of the class. It will initialize the class with the rgb color passed as default
*
* @param activity The reference to the activity where the color picker is called
* @param color ARGB color
public ColorPicker(Activity activity,
@ColorInt int color) {
this(activity);
this.alpha = Color.alpha(color);
this.red = Color.red(color);
this.green = Color.green(color);
this.blue = Color.blue(color);
this.withAlpha = this.alpha < 255;
}
/**
* Creator of the class. It will initialize the class with the argb color passed as default
Expand Down

0 comments on commit f0eef58

Please sign in to comment.