From f86df994fa7b4f649bc6be551b6897fe82108e71 Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Mon, 22 Apr 2019 14:23:47 -0400 Subject: [PATCH] Fix colors in QS Header Fixes icon and text colors in QS Header to be darker in Light mode. Also, makes sure that all colors in the icons match. Does this by implementing the following: * A new theme that overrides darkIconTheme in Theme.SystemUI by one with darker colors. * QuickStatusBarHeader applies that theme and passes is onto its children, in particular StatusIconContainer/StatusBarMobileView and BatteryMeterView. * StatusBarMobileView and BatteryMeterView retrieve the colors from the theme and apply them accordingly. * Also applies to QSCarrierGroup * Additionally, the single color is used for the other icons. Also invalidates SignalDrawable after setColors is called if at least one of the colors changed. This is a real issue. For more info: * Text and icons set to 70% black on light mode, white in dark mode. * Dual tone set for background overlaid with fill match single tone. Test: visual Fixes: 124466915 Change-Id: Ia6cb28fca90a07c8936726334502e7accf534df6 --- .../settingslib/graph/SignalDrawable.java | 3 + .../res/layout/quick_qs_status_icons.xml | 3 +- .../res/layout/quick_settings_header_info.xml | 5 +- packages/SystemUI/res/values-night/styles.xml | 5 + packages/SystemUI/res/values/colors.xml | 5 + packages/SystemUI/res/values/styles.xml | 12 +++ .../android/systemui/BatteryMeterView.java | 41 ++------ .../com/android/systemui/DualToneHandler.kt | 99 +++++++++++++++++++ .../com/android/systemui/qs/QSCarrier.java | 10 +- .../systemui/qs/QuickStatusBarHeader.java | 20 ++-- .../statusbar/StatusBarMobileView.java | 12 ++- 11 files changed, 160 insertions(+), 55 deletions(-) create mode 100644 packages/SystemUI/src/com/android/systemui/DualToneHandler.kt diff --git a/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java b/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java index a6b57550c358c..4bd1bbb9e3bf4 100644 --- a/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java +++ b/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java @@ -203,8 +203,11 @@ public class SignalDrawable extends Drawable { } public void setColors(int background, int foreground) { + int colorBackground = mPaint.getColor(); + int colorForeground = mForegroundPaint.getColor(); mPaint.setColor(background); mForegroundPaint.setColor(foreground); + if (colorBackground != background || colorForeground != foreground) invalidateSelf(); } public void setDarkIntensity(float darkIntensity) { diff --git a/packages/SystemUI/res/layout/quick_qs_status_icons.xml b/packages/SystemUI/res/layout/quick_qs_status_icons.xml index 83fad66454f37..7f69cf4d239cc 100644 --- a/packages/SystemUI/res/layout/quick_qs_status_icons.xml +++ b/packages/SystemUI/res/layout/quick_qs_status_icons.xml @@ -28,7 +28,8 @@ android:clipToPadding="false" android:minHeight="20dp" android:clickable="false" - android:focusable="true"> + android:focusable="true" + android:theme="@style/QSHeaderTheme"> + android:paddingEnd="@dimen/status_bar_padding_end" + android:theme="@style/QSHeaderTheme"> @@ -85,7 +85,6 @@ android:id="@+id/ringer_mode_icon" android:layout_width="@dimen/qs_header_alarm_icon_size" android:layout_height="@dimen/qs_header_alarm_icon_size" - android:tint="?android:attr/textColorPrimary" android:visibility="gone"/> true + + diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index d2a005fc55df2..4e1a7d07e687e 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -118,6 +118,11 @@ #4dffffff #ffffff + #B3000000 + #3d000000 + + #99000000 + #ff000000 #ffffff #59000000 diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 9b471c9c17dcc..4b6434744394e 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -224,6 +224,7 @@ + + + +