Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 716714a0 authored by Sam Mortimer's avatar Sam Mortimer Committed by Adnan Begovic
Browse files

Light settings: reduce tone if preview image color is very light

Prevents material whiteout in color preview.

Change-Id: Idfa47e57bdb669b17b610b737d0fe2c942b47d78
parent 3e2025a5
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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));
+2 −5
Original line number Diff line number Diff line
@@ -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);