diff --git a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPreference.java b/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPreference.java index 0021dd5..bbcdf3a 100644 --- a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPreference.java +++ b/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPreference.java @@ -204,6 +204,24 @@ public String getFragmentTag() { return "color_" + getKey(); } + /** + * Get the color of the key. This should be one of the entries in {@link #getPresets()}. + * + * @return The color of the key + */ + public int getColor() { + return color; + } + + /** + * Sets the color selected. This should be one of the entries in {@link #getPresets()}. + * + * @param color The color to set for the key + */ + public void setColor(@ColorInt int color) { + this.color = color; + } + public interface OnShowDialogListener { void onShowColorPickerDialog(String title, int currentColor); diff --git a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPreferenceCompat.java b/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPreferenceCompat.java index 42e579e..ee75a43 100644 --- a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPreferenceCompat.java +++ b/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPreferenceCompat.java @@ -200,6 +200,24 @@ public String getFragmentTag() { return "color_" + getKey(); } + /** + * Get the color of the key. This should be one of the entries in {@link #getPresets()}. + * + * @return The color of the key + */ + public int getColor() { + return color; + } + + /** + * Sets the color selected. This should be one of the entries in {@link #getPresets()}. + * + * @param color The color to set for the key + */ + public void setColor(@ColorInt int color) { + this.color = color; + } + public interface OnShowDialogListener { void onShowColorPickerDialog(String title, int currentColor);