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
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user