Color Picker: don't show picker on click if preference is disabled
Signed-off-by: xyyx <xyyx@mail.ru>
This commit is contained in:
@@ -49,6 +49,7 @@ public class ColorPickerPreference extends Preference implements
|
|||||||
private int mValue = Color.BLACK;
|
private int mValue = Color.BLACK;
|
||||||
private float mDensity = 0;
|
private float mDensity = 0;
|
||||||
private boolean mAlphaSliderEnabled = false;
|
private boolean mAlphaSliderEnabled = false;
|
||||||
|
private boolean mEnabled = true;
|
||||||
|
|
||||||
// if we return -6, button is not enabled
|
// if we return -6, button is not enabled
|
||||||
static final String SETTINGS_NS = "http://schemas.android.com/apk/res/com.android.settings";
|
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() {
|
iView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
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() {
|
private Bitmap getPreviewBitmap() {
|
||||||
int d = (int) (mDensity * 31); // 30dip
|
int d = (int) (mDensity * 31); // 30dip
|
||||||
int color = mValue;
|
int color = mValue;
|
||||||
|
|||||||
Reference in New Issue
Block a user