Loading packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +17 −10 Original line number Diff line number Diff line Loading @@ -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) { Loading @@ -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; Loading packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +5 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,6 @@ public class QuickStatusBarHeader extends RelativeLayout mIconManager.setTint(fillColor); BatteryMeterView battery = findViewById(R.id.battery); battery.setFillColor(Color.WHITE); battery.setForceShowPercent(true); mActivityStarter = Dependency.get(ActivityStarter.class); Loading Loading @@ -216,6 +215,11 @@ public class QuickStatusBarHeader extends RelativeLayout //host.setHeaderView(mExpandIndicator); mHeaderQsPanel.setQSPanelAndHeader(mQsPanel, this); mHeaderQsPanel.setHost(host, null /* No customization in header */); // Use SystemUI context to get battery meter colors, and let it use the default tint (white) BatteryMeterView battery = findViewById(R.id.battery); battery.setColorsFromContext(mHost.getContext()); battery.onDarkChanged(new Rect(), 0, DarkIconDispatcher.DEFAULT_ICON_TINT); } public void setCallback(Callback qsPanelCallback) { Loading Loading
packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +17 −10 Original line number Diff line number Diff line Loading @@ -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) { Loading @@ -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; Loading
packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +5 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,6 @@ public class QuickStatusBarHeader extends RelativeLayout mIconManager.setTint(fillColor); BatteryMeterView battery = findViewById(R.id.battery); battery.setFillColor(Color.WHITE); battery.setForceShowPercent(true); mActivityStarter = Dependency.get(ActivityStarter.class); Loading Loading @@ -216,6 +215,11 @@ public class QuickStatusBarHeader extends RelativeLayout //host.setHeaderView(mExpandIndicator); mHeaderQsPanel.setQSPanelAndHeader(mQsPanel, this); mHeaderQsPanel.setHost(host, null /* No customization in header */); // Use SystemUI context to get battery meter colors, and let it use the default tint (white) BatteryMeterView battery = findViewById(R.id.battery); battery.setColorsFromContext(mHost.getContext()); battery.onDarkChanged(new Rect(), 0, DarkIconDispatcher.DEFAULT_ICON_TINT); } public void setCallback(Callback qsPanelCallback) { Loading