Merge "Fixed an issue in the contrast calculation" into oc-dev am: 9bf5c0c3e1
am: 12a2a7d0f1
Change-Id: Ice72e01f1ce2a38739c4306b9df4ab33bc16b2c9
This commit is contained in:
@@ -534,7 +534,7 @@ public class NotificationColorUtil {
|
||||
}
|
||||
|
||||
public static boolean satisfiesTextContrast(int backgroundColor, int foregroundColor) {
|
||||
return NotificationColorUtil.calculateContrast(backgroundColor, foregroundColor) >= 4.5;
|
||||
return NotificationColorUtil.calculateContrast(foregroundColor, backgroundColor) >= 4.5;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -613,7 +613,7 @@ public class NotificationColorUtil {
|
||||
*/
|
||||
public static double calculateContrast(@ColorInt int foreground, @ColorInt int background) {
|
||||
if (Color.alpha(background) != 255) {
|
||||
throw new IllegalArgumentException("background can not be translucent: #"
|
||||
Log.wtf(TAG, "background can not be translucent: #"
|
||||
+ Integer.toHexString(background));
|
||||
}
|
||||
if (Color.alpha(foreground) < 255) {
|
||||
|
||||
Reference in New Issue
Block a user