OSDN Git Service

Light settings: reduce tone if preview image color is very light
authorSam Mortimer <sam@mortimer.me.uk>
Tue, 25 Nov 2014 05:51:27 +0000 (21:51 -0800)
committerAdnan Begovic <adnan@cyngn.com>
Tue, 22 Dec 2015 20:45:07 +0000 (12:45 -0800)
Prevents material whiteout in color preview.

Change-Id: Idfa47e57bdb669b17b610b737d0fe2c942b47d78

src/com/android/settings/notificationlight/ApplicationLightPreference.java
src/com/android/settings/notificationlight/NotificationLightSettings.java

index c6b534e..9feb050 100644 (file)
@@ -36,7 +36,7 @@ public class ApplicationLightPreference extends DialogPreference {
 
     private static String TAG = "AppLightPreference";
     public static final int DEFAULT_TIME = 1000;
-    public static final int DEFAULT_COLOR = 0xeeeeee; //off-White since white does not show in UI
+    public static final int DEFAULT_COLOR = 0xffffff;
 
     private ImageView mLightColorView;
     private TextView mOnValueView;
@@ -138,7 +138,11 @@ public class ApplicationLightPreference extends DialogPreference {
 
         if (mLightColorView != null) {
             mLightColorView.setEnabled(true);
-            mLightColorView.setImageDrawable(createOvalShape(size, 0xFF000000 + mColorValue));
+            // adjust if necessary to prevent material whiteout
+            final int imageColor = ((mColorValue & 0xF0F0F0) == 0xF0F0F0) ?
+                    (mColorValue - 0x101010) : mColorValue;
+            mLightColorView.setImageDrawable(createOvalShape(size,
+                    0xFF000000 + imageColor));
         }
         if (mOnValueView != null) {
             mOnValueView.setText(mapLengthValue(mOnValue));
index d70977f..597ea3a 100644 (file)
@@ -96,11 +96,8 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
         PreferenceGroup mAdvancedPrefs = (PreferenceGroup) prefSet.findPreference("advanced_section");
 
         // Get the system defined default notification color
-        mDefaultColor = resources.getColor(com.android.internal.R.color.config_defaultNotificationColor);
-        if (mDefaultColor == Color.WHITE) {
-            // We cannot properly show white in the UI, change it to off white (#eeeeee)
-            mDefaultColor = 0xFFEEEEEE;
-        }
+        mDefaultColor =
+                resources.getColor(com.android.internal.R.color.config_defaultNotificationColor);
 
         mDefaultLedOn = resources.getInteger(
                 com.android.internal.R.integer.config_defaultNotificationLedOn);