From 58be7a675b7aa505255f0c91fee755f8290e8363 Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Wed, 1 Feb 2017 20:17:51 -0500 Subject: [PATCH] Add colorError Remove scatered references to old error color and replace them with references to new colorError Test: make & visual Change-Id: Icca8cd790db351c3dfce2197f2046879d062a2c0 --- api/current.txt | 2 +- api/system-current.txt | 2 +- api/test-current.txt | 2 +- .../com/android/internal/widget/LockPatternView.java | 12 +++++------- core/res/res/layout/app_permission_item_money.xml | 4 ++-- core/res/res/layout/time_picker_text_input_material.xml | 4 ++-- core/res/res/values/attrs.xml | 8 +++++--- core/res/res/values/colors.xml | 5 ----- core/res/res/values/colors_material.xml | 4 +--- core/res/res/values/public.xml | 2 +- core/res/res/values/styles.xml | 6 ++++++ core/res/res/values/symbols.xml | 4 ++-- core/res/res/values/themes.xml | 2 +- core/res/res/values/themes_material.xml | 5 +---- packages/SettingsLib/res/values/arrays.xml | 2 +- .../SettingsLib/src/com/android/settingslib/Utils.java | 5 +---- .../settingslib/graph/BatteryMeterDrawableBase.java | 11 ++++++++--- packages/SystemUI/res/drawable/ic_fingerprint_error.xml | 6 +++--- .../lockscreen_fingerprint_error_state_to_fp.xml | 6 +++--- .../lockscreen_fingerprint_fp_to_error_state.xml | 16 ++++++++-------- packages/SystemUI/res/values/colors.xml | 1 - packages/SystemUI/res/values/styles.xml | 10 +++++----- .../systemui/power/PowerNotificationWarnings.java | 7 +++---- .../android/systemui/qs/tiles/DataUsageDetailView.java | 2 +- .../systemui/statusbar/KeyguardIndicationController.java | 8 ++++---- .../android/systemui/statusbar/phone/BarTransitions.java | 3 ++- 26 files changed, 68 insertions(+), 71 deletions(-) diff --git a/api/current.txt b/api/current.txt index 62365cce20a9..3e9fc84d24e4 100644 --- a/api/current.txt +++ b/api/current.txt @@ -410,6 +410,7 @@ package android { field public static final int colorControlHighlight = 16843820; // 0x101042c field public static final int colorControlNormal = 16843817; // 0x1010429 field public static final int colorEdgeEffect = 16843982; // 0x10104ce + field public static final int colorError = 16844100; // 0x1010544 field public static final int colorFocusedHighlight = 16843663; // 0x101038f field public static final int colorForeground = 16842800; // 0x1010030 field public static final int colorForegroundInverse = 16843270; // 0x1010206 @@ -1316,7 +1317,6 @@ package android { field public static final int textCheckMarkInverse = 16842823; // 0x1010047 field public static final int textColor = 16842904; // 0x1010098 field public static final int textColorAlertDialogListItem = 16843526; // 0x1010306 - field public static final int textColorError = 16844100; // 0x1010544 field public static final int textColorHighlight = 16842905; // 0x1010099 field public static final int textColorHighlightInverse = 16843599; // 0x101034f field public static final int textColorHint = 16842906; // 0x101009a diff --git a/api/system-current.txt b/api/system-current.txt index 8626f1b33fa4..6593050857be 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -523,6 +523,7 @@ package android { field public static final int colorControlHighlight = 16843820; // 0x101042c field public static final int colorControlNormal = 16843817; // 0x1010429 field public static final int colorEdgeEffect = 16843982; // 0x10104ce + field public static final int colorError = 16844100; // 0x1010544 field public static final int colorFocusedHighlight = 16843663; // 0x101038f field public static final int colorForeground = 16842800; // 0x1010030 field public static final int colorForegroundInverse = 16843270; // 0x1010206 @@ -1433,7 +1434,6 @@ package android { field public static final int textCheckMarkInverse = 16842823; // 0x1010047 field public static final int textColor = 16842904; // 0x1010098 field public static final int textColorAlertDialogListItem = 16843526; // 0x1010306 - field public static final int textColorError = 16844100; // 0x1010544 field public static final int textColorHighlight = 16842905; // 0x1010099 field public static final int textColorHighlightInverse = 16843599; // 0x101034f field public static final int textColorHint = 16842906; // 0x101009a diff --git a/api/test-current.txt b/api/test-current.txt index 44386bec120a..e077d65c054a 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -410,6 +410,7 @@ package android { field public static final int colorControlHighlight = 16843820; // 0x101042c field public static final int colorControlNormal = 16843817; // 0x1010429 field public static final int colorEdgeEffect = 16843982; // 0x10104ce + field public static final int colorError = 16844100; // 0x1010544 field public static final int colorFocusedHighlight = 16843663; // 0x101038f field public static final int colorForeground = 16842800; // 0x1010030 field public static final int colorForegroundInverse = 16843270; // 0x1010206 @@ -1316,7 +1317,6 @@ package android { field public static final int textCheckMarkInverse = 16842823; // 0x1010047 field public static final int textColor = 16842904; // 0x1010098 field public static final int textColorAlertDialogListItem = 16843526; // 0x1010306 - field public static final int textColorError = 16844100; // 0x1010544 field public static final int textColorHighlight = 16842905; // 0x1010099 field public static final int textColorHighlightInverse = 16843599; // 0x101034f field public static final int textColorHint = 16842906; // 0x101009a diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java index ae2e0ac88b39..cc1c65ec24bb 100644 --- a/core/java/com/android/internal/widget/LockPatternView.java +++ b/core/java/com/android/internal/widget/LockPatternView.java @@ -278,7 +278,8 @@ public class LockPatternView extends View { public LockPatternView(Context context, AttributeSet attrs) { super(context, attrs); - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LockPatternView); + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LockPatternView, + R.attr.lockPatternStyle, R.style.Widget_LockPatternView); final String aspect = a.getString(R.styleable.LockPatternView_aspect); @@ -298,12 +299,9 @@ public class LockPatternView extends View { mPathPaint.setAntiAlias(true); mPathPaint.setDither(true); - mRegularColor = context.getColor(R.color.lock_pattern_view_regular_color); - mErrorColor = context.getColor(R.color.lock_pattern_view_error_color); - mSuccessColor = context.getColor(R.color.lock_pattern_view_success_color); - mRegularColor = a.getColor(R.styleable.LockPatternView_regularColor, mRegularColor); - mErrorColor = a.getColor(R.styleable.LockPatternView_errorColor, mErrorColor); - mSuccessColor = a.getColor(R.styleable.LockPatternView_successColor, mSuccessColor); + mRegularColor = a.getColor(R.styleable.LockPatternView_regularColor, 0); + mErrorColor = a.getColor(R.styleable.LockPatternView_errorColor, 0); + mSuccessColor = a.getColor(R.styleable.LockPatternView_successColor, 0); int pathColor = a.getColor(R.styleable.LockPatternView_pathColor, mRegularColor); mPathPaint.setColor(pathColor); diff --git a/core/res/res/layout/app_permission_item_money.xml b/core/res/res/layout/app_permission_item_money.xml index 205628566170..764c883e0345 100644 --- a/core/res/res/layout/app_permission_item_money.xml +++ b/core/res/res/layout/app_permission_item_money.xml @@ -57,14 +57,14 @@ android:layout_alignParentStart="true" android:layout_alignBottom="@+id/perm_money_label" android:scaleType="fitCenter" - android:tint="@color/perms_costs_money" + android:tint="?android:attr/colorError" android:tintMode="src_in" android:src="@android:drawable/ic_coins_s" /> - \ No newline at end of file + diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 8031f1934088..f55538f67dbc 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -66,6 +66,9 @@ + + - - - @@ -8531,4 +8531,6 @@ + + diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml index b28c6f2d22e3..6015ed5259d8 100644 --- a/core/res/res/values/colors.xml +++ b/core/res/res/values/colors.xml @@ -75,8 +75,6 @@ #fff9f9f9 #ff000000 - #fff4511e - #ff0092f4 @@ -88,7 +86,6 @@ #33b5e5 #33b5e5 #cc222222 - #fff4511e #7fa87f @@ -121,7 +118,6 @@ #ffffffff #ffffffff - @color/system_error #CC000000 @@ -156,7 +152,6 @@ #bf39b500 #ff607D8B - #fff4511e #ff00bcd4 diff --git a/core/res/res/values/colors_material.xml b/core/res/res/values/colors_material.xml index 0a24565049ab..e0cc5b51e25b 100644 --- a/core/res/res/values/colors_material.xml +++ b/core/res/res/values/colors_material.xml @@ -46,6 +46,7 @@ #ff5a595b #ffd6d7d7 + #F4511E #ffbdbdbd #fff1f1f1 @@ -65,9 +66,6 @@ #b3ffffff - @color/material_red_A700 - @color/material_red_A100 - 0.50 0.38 diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 78549b52edd6..e5660b520c9a 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2780,7 +2780,7 @@ - + diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index faf451bcec97..25873d2f8fd7 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -1475,4 +1475,10 @@ please see styles_device_defaults.xml. 16dp + + diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index e7d3ec914767..32c6640b0819 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1195,7 +1195,6 @@ - @@ -2310,7 +2309,6 @@ - @@ -2880,6 +2878,8 @@ + + diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index e3576781ce62..d100c63d4ec1 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -63,6 +63,7 @@ please see themes_device_defaults.xml. @color/legacy_button_pressed @color/legacy_button_normal ?attr/colorPrimary + @color/red 0.5 0.6 @@ -93,7 +94,6 @@ please see themes_device_defaults.xml. @color/link_text_dark @color/link_text_light @color/primary_text_light_disable_only - @color/red @style/TextAppearance.Large @style/TextAppearance.Medium diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml index 400fb47ba9e3..008c817dd73c 100644 --- a/core/res/res/values/themes_material.xml +++ b/core/res/res/values/themes_material.xml @@ -51,6 +51,7 @@ please see themes_device_defaults.xml. @dimen/primary_content_alpha_material_dark @dimen/secondary_content_alpha_material_dark 0.6 + @color/error_color_material @style/TextAppearance.Material @@ -73,7 +74,6 @@ please see themes_device_defaults.xml. ?attr/colorAccent @color/search_url_text_material_dark @color/primary_text_material_dark - @color/error_text_material_dark @style/TextAppearance.Material.Large @style/TextAppearance.Material.Large.Inverse @@ -441,7 +441,6 @@ please see themes_device_defaults.xml. ?attr/colorAccent @color/search_url_text_material_light @color/primary_text_material_light - @color/error_text_material_light @style/TextAppearance.Material.Large @style/TextAppearance.Material.Large.Inverse @@ -823,7 +822,6 @@ please see themes_device_defaults.xml. @color/highlighted_text_material @color/search_url_text_material_light @color/primary_text_material_light - @color/error_text_material_light @drawable/indicator_check_mark_light @drawable/indicator_check_mark_dark @@ -856,7 +854,6 @@ please see themes_device_defaults.xml. @color/highlighted_text_material @color/search_url_text_material_dark @color/primary_text_material_dark - @color/error_text_material_dark @drawable/indicator_check_mark_dark @drawable/indicator_check_mark_light diff --git a/packages/SettingsLib/res/values/arrays.xml b/packages/SettingsLib/res/values/arrays.xml index d207c35732c8..9ff22c79b358 100644 --- a/packages/SettingsLib/res/values/arrays.xml +++ b/packages/SettingsLib/res/values/arrays.xml @@ -538,7 +538,7 @@ 100 - @*android:color/battery_saver_mode_color + ?android:attr/colorError @android:color/white diff --git a/packages/SettingsLib/src/com/android/settingslib/Utils.java b/packages/SettingsLib/src/com/android/settingslib/Utils.java index 7a4514a0af5e..7e7b391ffd1a 100644 --- a/packages/SettingsLib/src/com/android/settingslib/Utils.java +++ b/packages/SettingsLib/src/com/android/settingslib/Utils.java @@ -184,10 +184,7 @@ public class Utils { @ColorInt public static int getColorError(Context context) { - TypedArray ta = context.obtainStyledAttributes(new int[]{android.R.attr.textColorError}); - @ColorInt int colorError = ta.getColor(0, 0); - ta.recycle(); - return colorError; + return getColorAttr(context, android.R.attr.colorError); } @ColorInt diff --git a/packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java b/packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java index fd2e7cad5c86..6764a6bb7f47 100755 --- a/packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java +++ b/packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java @@ -29,7 +29,8 @@ import android.graphics.Path; import android.graphics.RectF; import android.graphics.Typeface; import android.graphics.drawable.Drawable; -import android.provider.Settings; +import android.util.TypedValue; + import com.android.settingslib.R; import com.android.settingslib.Utils; @@ -97,9 +98,13 @@ public class BatteryMeterDrawableBase extends Drawable { final int N = levels.length(); mColors = new int[2 * N]; - for (int i = 0; i < N; i++) { + for (int i=0; i < N; i++) { mColors[2 * i] = levels.getInt(i, 0); - mColors[2 * i + 1] = colors.getColor(i, 0); + if (colors.getType(i) == TypedValue.TYPE_ATTRIBUTE) { + mColors[2 * i + 1] = Utils.getColorAttr(context, colors.getResourceId(i, 0)); + } else { + mColors[2 * i + 1] = colors.getColor(i, 0); + } } levels.recycle(); colors.recycle(); diff --git a/packages/SystemUI/res/drawable/ic_fingerprint_error.xml b/packages/SystemUI/res/drawable/ic_fingerprint_error.xml index 11e83a19da75..a7fb1a136295 100644 --- a/packages/SystemUI/res/drawable/ic_fingerprint_error.xml +++ b/packages/SystemUI/res/drawable/ic_fingerprint_error.xml @@ -19,12 +19,12 @@ Copyright (C) 2015 The Android Open Source Project android:viewportWidth="32.0" android:viewportHeight="32.0"> diff --git a/packages/SystemUI/res/drawable/lockscreen_fingerprint_error_state_to_fp.xml b/packages/SystemUI/res/drawable/lockscreen_fingerprint_error_state_to_fp.xml index e207cb3808c0..3af2f7fbbc3f 100644 --- a/packages/SystemUI/res/drawable/lockscreen_fingerprint_error_state_to_fp.xml +++ b/packages/SystemUI/res/drawable/lockscreen_fingerprint_error_state_to_fp.xml @@ -98,11 +98,11 @@ + android:fillColor="?android:attr/colorError" /> + android:fillColor="?android:attr/colorError" /> diff --git a/packages/SystemUI/res/drawable/lockscreen_fingerprint_fp_to_error_state.xml b/packages/SystemUI/res/drawable/lockscreen_fingerprint_fp_to_error_state.xml index 2b4babce277b..a577afc75d9e 100644 --- a/packages/SystemUI/res/drawable/lockscreen_fingerprint_fp_to_error_state.xml +++ b/packages/SystemUI/res/drawable/lockscreen_fingerprint_fp_to_error_state.xml @@ -96,7 +96,7 @@ @@ -106,7 +106,7 @@ @@ -116,7 +116,7 @@ @@ -126,7 +126,7 @@ @@ -138,7 +138,7 @@ @@ -157,11 +157,11 @@ + android:fillColor="?android:attr/colorError" /> + android:fillColor="?android:attr/colorError" /> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 407cddf54b77..f461bb3ffedf 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -27,7 +27,6 @@ #80000000 #ff33B5E5 #FF404040 - @*android:color/system_error #29ffffff #99FFFFFF @*android:color/quaternary_device_default_settings diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 48b76648e7a3..9168256eca89 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -30,7 +30,7 @@ @@ -70,7 +70,7 @@ @null @null @null - @color/transparent + @*android:color/transparent @style/Animation.PipPhoneOverlayControl @@ -164,7 +164,7 @@ diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java index 09ce2ada11e0..daf0622fa7a6 100644 --- a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java +++ b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java @@ -39,6 +39,7 @@ import android.provider.Settings; import android.util.Slog; import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; +import com.android.settingslib.Utils; import com.android.systemui.R; import com.android.systemui.SystemUI; import com.android.systemui.statusbar.phone.StatusBar; @@ -175,8 +176,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { .setOnlyAlertOnce(true) .setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_WARNING)) .setVisibility(Notification.VISIBILITY_PUBLIC) - .setColor(mContext.getColor( - com.android.internal.R.color.battery_saver_mode_color)); + .setColor(Utils.getColorAttr(mContext, android.R.attr.colorError)); if (hasBatterySettings()) { nb.setContentIntent(pendingBroadcast(ACTION_SHOW_BATTERY_SETTINGS)); } @@ -245,8 +245,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { .setVisibility(Notification.VISIBILITY_PUBLIC) .setContentIntent(pendingBroadcast(ACTION_CLICKED_TEMP_WARNING)) .setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_TEMP_WARNING)) - .setColor(mContext.getColor( - com.android.internal.R.color.battery_saver_mode_color)); + .setColor(Utils.getColorAttr(mContext, android.R.attr.colorError)); SystemUI.overrideNotificationAppName(mContext, nb); final Notification n = nb.build(); mNoMan.notifyAsUser(TAG_TEMPERATURE, SystemMessage.NOTE_HIGH_TEMP, n, UserHandle.ALL); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java index c7b6aea9c392..9cd79f84cb89 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java @@ -91,7 +91,7 @@ public class DataUsageDetailView extends LinearLayout { formatBytes(info.usageLevel)); bottom = res.getString(R.string.quick_settings_cellular_detail_data_limit, formatBytes(info.limitLevel)); - usageColor = mContext.getColor(R.color.system_warning_color); + usageColor = Utils.getDefaultColor(mContext, android.R.attr.colorError); } if (usageColor == 0) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index bc992d821998..fb92a67c6aac 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -42,6 +42,7 @@ import android.view.ViewGroup; import com.android.internal.app.IBatteryStats; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; +import com.android.settingslib.Utils; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; @@ -365,7 +366,7 @@ public class KeyguardIndicationController { if (!updateMonitor.isUnlockingWithFingerprintAllowed()) { return; } - int errorColor = mContext.getResources().getColor(R.color.system_warning_color, null); + int errorColor = Utils.getColorError(mContext); if (mStatusBarKeyguardViewManager.isBouncerShowing()) { mStatusBarKeyguardViewManager.showBouncerMessage(helpString, errorColor); } else if (updateMonitor.isDeviceInteractive() @@ -388,7 +389,7 @@ public class KeyguardIndicationController { || msgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED) { return; } - int errorColor = mContext.getResources().getColor(R.color.system_warning_color, null); + int errorColor = Utils.getColorError(mContext); if (mStatusBarKeyguardViewManager.isBouncerShowing()) { // When swiping up right after receiving a fingerprint error, the bouncer calls // authenticate leading to the same message being shown again on the bouncer. @@ -411,8 +412,7 @@ public class KeyguardIndicationController { @Override public void onScreenTurnedOn() { if (mMessageToShowOnScreenOn != null) { - int errorColor = mContext.getResources().getColor(R.color.system_warning_color, - null); + int errorColor = Utils.getColorError(mContext); showTransientIndication(mMessageToShowOnScreenOn, errorColor); // We want to keep this message around in case the screen was off mHandler.removeMessages(MSG_HIDE_TRANSIENT); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java index ed71e5708ce1..f3c2bc56b409 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java @@ -33,6 +33,7 @@ import android.os.SystemClock; import android.util.Log; import android.view.View; +import com.android.settingslib.Utils; import com.android.systemui.Interpolators; import com.android.systemui.R; @@ -167,7 +168,7 @@ public class BarTransitions { mSemiTransparent = context.getColor( com.android.internal.R.color.system_bar_background_semi_transparent); mTransparent = context.getColor(R.color.system_bar_background_transparent); - mWarning = context.getColor(com.android.internal.R.color.battery_saver_mode_color); + mWarning = Utils.getColorAttr(context, android.R.attr.colorError); } mGradient = context.getDrawable(gradientResourceId); } -- 2.11.0