cmsdk: Add preference for automatic notification colors
Change-Id: I4bdb430917dac69f397995ea1c2abcacfb62136e
This commit is contained in:
parent
eb17396831
commit
c30bcacbca
|
@ -1713,6 +1713,19 @@ public final class CMSettings {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether we automatically generate notification LED colors or just
|
||||||
|
* use the boring default.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String NOTIFICATION_LIGHT_COLOR_AUTO =
|
||||||
|
"notification_light_color_auto";
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public static final Validator NOTIFICATION_LIGHT_COLOR_AUTO_VALIDATOR =
|
||||||
|
sBooleanValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* I can haz more bukkits
|
* I can haz more bukkits
|
||||||
* @hide
|
* @hide
|
||||||
|
@ -1958,6 +1971,8 @@ public final class CMSettings {
|
||||||
NOTIFICATION_LIGHT_PULSE_CUSTOM_ENABLE_VALIDATOR);
|
NOTIFICATION_LIGHT_PULSE_CUSTOM_ENABLE_VALIDATOR);
|
||||||
VALIDATORS.put(NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES,
|
VALIDATORS.put(NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES,
|
||||||
NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES_VALIDATOR);
|
NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES_VALIDATOR);
|
||||||
|
VALIDATORS.put(NOTIFICATION_LIGHT_COLOR_AUTO,
|
||||||
|
NOTIFICATION_LIGHT_COLOR_AUTO_VALIDATOR);
|
||||||
VALIDATORS.put(__MAGICAL_TEST_PASSING_ENABLER,
|
VALIDATORS.put(__MAGICAL_TEST_PASSING_ENABLER,
|
||||||
__MAGICAL_TEST_PASSING_ENABLER_VALIDATOR);
|
__MAGICAL_TEST_PASSING_ENABLER_VALIDATOR);
|
||||||
};
|
};
|
||||||
|
|
|
@ -180,7 +180,9 @@ public class ColorUtils {
|
||||||
if (bitmap != null) {
|
if (bitmap != null) {
|
||||||
Palette p = Palette.generate(bitmap);
|
Palette p = Palette.generate(bitmap);
|
||||||
color = findPerceptuallyNearestSolidColor(p.getVibrantColor(0)) & 0xFFFFFF;
|
color = findPerceptuallyNearestSolidColor(p.getVibrantColor(0)) & 0xFFFFFF;
|
||||||
bitmap.recycle();
|
if (!(drawable instanceof BitmapDrawable)) {
|
||||||
|
bitmap.recycle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
|
|
Loading…
Reference in New Issue