Color Picker: don't show picker on click if preference is disabled
Signed-off-by: xyyx <xyyx@mail.ru>
Change-Id: I376e7ea4511638fa62aa9f3de4b2e050209f5a7a
diff --git a/src/com/bliss/support/colorpicker/ColorPickerPreference.java b/src/com/bliss/support/colorpicker/ColorPickerPreference.java
index 4e38c9f..b0f8e64 100644
--- a/src/com/bliss/support/colorpicker/ColorPickerPreference.java
+++ b/src/com/bliss/support/colorpicker/ColorPickerPreference.java
@@ -51,6 +51,7 @@
private int mValue = Color.BLACK;
private float mDensity = 0;
private boolean mAlphaSliderEnabled = false;
+ private boolean mEnabled = true;
// if we return -6, button is not enabled
static final String SETTINGS_NS = "http://schemas.android.com/apk/res/com.android.settings";
@@ -207,11 +208,21 @@
iView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- showDialog(null);
+ if (mEnabled) {
+ showDialog(null);
+ }
}
});
}
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ if (mEnabled != enabled) {
+ mEnabled = enabled;
+ }
+ }
+
private Bitmap getPreviewBitmap() {
int d = (int) (mDensity * 31); // 30dip
int color = mValue;