summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
diff options
context:
space:
mode:
authorFabian Kozynski <kozynski@google.com>2019-04-22 14:23:47 -0400
committerFabian Kozynski <kozynski@google.com>2019-04-25 14:04:07 +0000
commitf86df994fa7b4f649bc6be551b6897fe82108e71 (patch)
treec243e0151a28f50f78f1bf107078bf4c7f0bfae8 /packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
parent7aa5752bbe852294e4ea59a637466aa95262106c (diff)
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
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/BatteryMeterView.java')
-rw-r--r--packages/SystemUI/src/com/android/systemui/BatteryMeterView.java41
1 files changed, 6 insertions, 35 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
index 6c1d1f91830f..aeb35cd36809 100644
--- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
+++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
@@ -23,7 +23,6 @@ import static com.android.systemui.util.SysuiLifecycle.viewAttachLifecycle;
import static java.lang.annotation.RetentionPolicy.SOURCE;
-import android.animation.ArgbEvaluator;
import android.animation.LayoutTransition;
import android.animation.ObjectAnimator;
import android.annotation.IntDef;
@@ -39,7 +38,6 @@ import android.provider.Settings;
import android.util.ArraySet;
import android.util.AttributeSet;
import android.util.TypedValue;
-import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.ViewGroup;
@@ -99,13 +97,7 @@ public class BatteryMeterView extends LinearLayout implements
private boolean mIsSubscribedForTunerUpdates;
private boolean mCharging;
- private int mDarkModeSingleToneColor;
- private int mDarkModeBackgroundColor;
- private int mDarkModeFillColor;
-
- private int mLightModeSingleToneColor;
- private int mLightModeBackgroundColor;
- private int mLightModeFillColor;
+ private DualToneHandler mDualToneHandler;
private int mUser;
/**
@@ -161,7 +153,7 @@ public class BatteryMeterView extends LinearLayout implements
addView(mBatteryIconView, mlp);
updateShowPercent();
- setColorsFromContext(context);
+ mDualToneHandler = new DualToneHandler(context);
// Init to not dark at all.
onDarkChanged(new Rect(), 0, DarkIconDispatcher.DEFAULT_ICON_TINT);
@@ -282,21 +274,7 @@ public class BatteryMeterView extends LinearLayout implements
return;
}
- Context dualToneDarkTheme = new ContextThemeWrapper(context,
- Utils.getThemeAttr(context, R.attr.darkIconTheme));
- Context dualToneLightTheme = new ContextThemeWrapper(context,
- Utils.getThemeAttr(context, R.attr.lightIconTheme));
- mDarkModeSingleToneColor = Utils.getColorAttrDefaultColor(dualToneDarkTheme,
- R.attr.singleToneColor);
- mDarkModeBackgroundColor = Utils.getColorAttrDefaultColor(dualToneDarkTheme,
- R.attr.backgroundColor);
- mDarkModeFillColor = Utils.getColorAttrDefaultColor(dualToneDarkTheme,
- R.attr.fillColor);
- mLightModeSingleToneColor = Utils.getColorAttrDefaultColor(dualToneLightTheme,
- R.attr.singleToneColor);
- mLightModeBackgroundColor = Utils.getColorAttrDefaultColor(dualToneLightTheme,
- R.attr.backgroundColor);
- mLightModeFillColor = Utils.getColorAttrDefaultColor(dualToneLightTheme, R.attr.fillColor);
+ mDualToneHandler.setColorsFromContext(context);
}
@Override
@@ -448,12 +426,9 @@ public class BatteryMeterView extends LinearLayout implements
@Override
public void onDarkChanged(Rect area, float darkIntensity, int tint) {
float intensity = DarkIconDispatcher.isInArea(area, this) ? darkIntensity : 0;
- mNonAdaptedSingleToneColor = getColorForDarkIntensity(
- intensity, mLightModeSingleToneColor, mDarkModeSingleToneColor);
- mNonAdaptedForegroundColor = getColorForDarkIntensity(
- intensity, mLightModeFillColor, mDarkModeFillColor);
- mNonAdaptedBackgroundColor = getColorForDarkIntensity(
- intensity, mLightModeBackgroundColor,mDarkModeBackgroundColor);
+ mNonAdaptedSingleToneColor = mDualToneHandler.getSingleColor(intensity);
+ mNonAdaptedForegroundColor = mDualToneHandler.getFillColor(intensity);
+ mNonAdaptedBackgroundColor = mDualToneHandler.getBackgroundColor(intensity);
if (!mUseWallpaperTextColors) {
updateColors(mNonAdaptedForegroundColor, mNonAdaptedBackgroundColor,
@@ -469,10 +444,6 @@ public class BatteryMeterView extends LinearLayout implements
}
}
- private int getColorForDarkIntensity(float darkIntensity, int lightColor, int darkColor) {
- return (int) ArgbEvaluator.getInstance().evaluate(darkIntensity, lightColor, darkColor);
- }
-
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
String powerSave = mDrawable == null ? null : mDrawable.getPowerSaveEnabled() + "";
CharSequence percent = mBatteryPercentView == null ? null : mBatteryPercentView.getText();