diff options
author | Evan Laird <evanlaird@google.com> | 2018-01-29 14:08:45 -0500 |
---|---|---|
committer | Evan Laird <evanlaird@google.com> | 2018-01-29 14:10:38 -0500 |
commit | ef160f239ad8141bbb12cd00286772180b01d171 (patch) | |
tree | 51244445756f474e0a7e5e519de5fe9b2d298182 /packages/SystemUI/src/com/android/systemui/BatteryMeterView.java | |
parent | 90a823500e72296190e8e6eee03095c88f48db12 (diff) |
Fix battery background color in QS
Battery was only getting a foreground color, not background. Fix by
using the SystemUI context so it finds the correct light colors for both
foregorund and background.
Test: visual with light wallpaper
Change-Id: I6e18ce9331a5e78241d8c24ba96a8b843c646813
Fixes: 72431673
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/BatteryMeterView.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/BatteryMeterView.java | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java index 8666b0c873e7..1ae06d751255 100644 --- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java @@ -119,18 +119,10 @@ public class BatteryMeterView extends LinearLayout implements addView(mBatteryIconView, mlp); updateShowPercent(); - - Context dualToneDarkTheme = new ContextThemeWrapper(context, - Utils.getThemeAttr(context, R.attr.darkIconTheme)); - Context dualToneLightTheme = new ContextThemeWrapper(context, - Utils.getThemeAttr(context, R.attr.lightIconTheme)); - mDarkModeBackgroundColor = Utils.getColorAttr(dualToneDarkTheme, R.attr.backgroundColor); - mDarkModeFillColor = Utils.getColorAttr(dualToneDarkTheme, R.attr.fillColor); - mLightModeBackgroundColor = Utils.getColorAttr(dualToneLightTheme, R.attr.backgroundColor); - mLightModeFillColor = Utils.getColorAttr(dualToneLightTheme, R.attr.fillColor); - + setColorsFromContext(context); // Init to not dark at all. onDarkChanged(new Rect(), 0, DarkIconDispatcher.DEFAULT_ICON_TINT); + mUserTracker = new CurrentUserTracker(mContext) { @Override public void onUserSwitched(int newUserId) { @@ -148,6 +140,21 @@ public class BatteryMeterView extends LinearLayout implements updateShowPercent(); } + public void setColorsFromContext(Context context) { + if (context == null) { + return; + } + + Context dualToneDarkTheme = new ContextThemeWrapper(context, + Utils.getThemeAttr(context, R.attr.darkIconTheme)); + Context dualToneLightTheme = new ContextThemeWrapper(context, + Utils.getThemeAttr(context, R.attr.lightIconTheme)); + mDarkModeBackgroundColor = Utils.getColorAttr(dualToneDarkTheme, R.attr.backgroundColor); + mDarkModeFillColor = Utils.getColorAttr(dualToneDarkTheme, R.attr.fillColor); + mLightModeBackgroundColor = Utils.getColorAttr(dualToneLightTheme, R.attr.backgroundColor); + mLightModeFillColor = Utils.getColorAttr(dualToneLightTheme, R.attr.fillColor); + } + @Override public boolean hasOverlappingRendering() { return false; |