Color Picker: don't show picker on click if preference is disabled

Signed-off-by: xyyx <xyyx@mail.ru>
This commit is contained in:
ezio84
2017-09-18 09:12:57 +02:00
committed by hungphan2001
parent a5fd62d62f
commit 82cfe1a62e

View File

@@ -49,6 +49,7 @@ public class ColorPickerPreference extends Preference implements
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";
@@ -205,11 +206,21 @@ public class ColorPickerPreference extends Preference implements
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;