Fix staus bar colors when shade is down
Colors should be pulled from textColorPrimary, given that that's the color that contrast against the new scrim. Bug: 177907834 Test: visual Change-Id: Ic78ab99d414ad3a364250fa8468be7bad630bc5e
This commit is contained in:
@@ -107,6 +107,7 @@ public class QuickStatusBarHeader extends RelativeLayout implements LifecycleOwn
|
||||
private int mCutOutPaddingRight;
|
||||
private float mExpandedHeaderAlpha = 1.0f;
|
||||
private float mKeyguardExpansionFraction;
|
||||
private int mTextColorPrimary = Color.TRANSPARENT;
|
||||
|
||||
public QuickStatusBarHeader(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -132,14 +133,13 @@ public class QuickStatusBarHeader extends RelativeLayout implements LifecycleOwn
|
||||
mRingerModeTextView = findViewById(R.id.ringer_mode_text);
|
||||
mRingerContainer = findViewById(R.id.ringer_container);
|
||||
mPrivacyChip = findViewById(R.id.privacy_chip);
|
||||
mClockView = findViewById(R.id.clock);
|
||||
mSpace = findViewById(R.id.space);
|
||||
// Tint for the battery icons are handled in setupHost()
|
||||
mBatteryRemainingIcon = findViewById(R.id.batteryRemainingIcon);
|
||||
|
||||
updateResources();
|
||||
|
||||
mClockView = findViewById(R.id.clock);
|
||||
mSpace = findViewById(R.id.space);
|
||||
|
||||
// Tint for the battery icons are handled in setupHost()
|
||||
mBatteryRemainingIcon = findViewById(R.id.batteryRemainingIcon);
|
||||
// Don't need to worry about tuner settings for this icon
|
||||
mBatteryRemainingIcon.setIgnoreTunerUpdates(true);
|
||||
// QS will always show the estimate, and BatteryMeterView handles the case where
|
||||
@@ -147,19 +147,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements LifecycleOwn
|
||||
mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ESTIMATE);
|
||||
mRingerModeTextView.setSelected(true);
|
||||
mNextAlarmTextView.setSelected(true);
|
||||
|
||||
int colorForeground = Utils.getColorAttrDefaultColor(getContext(),
|
||||
android.R.attr.colorForeground);
|
||||
float intensity = getColorIntensity(colorForeground);
|
||||
int fillColor = mDualToneHandler.getSingleColor(intensity);
|
||||
|
||||
Rect tintArea = new Rect(0, 0, 0, 0);
|
||||
mBatteryRemainingIcon.onDarkChanged(tintArea, intensity, fillColor);
|
||||
|
||||
// The quick settings status bar clock depends on the color of the background scrim and
|
||||
// can be different from the status bar clock color.
|
||||
mClockView.setTextColor(
|
||||
Utils.getColorAttrDefaultColor(mContext, R.attr.wallpaperTextColor));
|
||||
}
|
||||
|
||||
void onAttach(TintedIconManager iconManager) {
|
||||
@@ -236,11 +223,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements LifecycleOwn
|
||||
protected void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
updateResources();
|
||||
|
||||
// Update color schemes in landscape to use wallpaperTextColor
|
||||
boolean shouldUseWallpaperTextColor =
|
||||
newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
|
||||
mClockView.useWallpaperTextColor(shouldUseWallpaperTextColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -288,6 +270,18 @@ public class QuickStatusBarHeader extends RelativeLayout implements LifecycleOwn
|
||||
}
|
||||
setLayoutParams(lp);
|
||||
|
||||
int textColor = Utils.getColorAttrDefaultColor(mContext, android.R.attr.textColorPrimary);
|
||||
if (textColor != mTextColorPrimary) {
|
||||
mTextColorPrimary = textColor;
|
||||
mClockView.setTextColor(textColor);
|
||||
|
||||
float intensity = getColorIntensity(textColor);
|
||||
int fillColor = mDualToneHandler.getSingleColor(intensity);
|
||||
|
||||
Rect tintArea = new Rect(0, 0, 0, 0);
|
||||
mBatteryRemainingIcon.onDarkChanged(tintArea, intensity, fillColor);
|
||||
}
|
||||
|
||||
updateStatusIconAlphaAnimator();
|
||||
updateHeaderTextContainerAlphaAnimator();
|
||||
updatePrivacyChipAlphaAnimator();
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.systemui.statusbar.policy;
|
||||
|
||||
import android.annotation.ColorInt;
|
||||
import android.app.StatusBarManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@@ -101,12 +100,6 @@ public class Clock extends TextView implements
|
||||
private boolean mShowSeconds;
|
||||
private Handler mSecondsHandler;
|
||||
|
||||
/**
|
||||
* Whether we should use colors that adapt based on wallpaper/the scrim behind quick settings
|
||||
* for text.
|
||||
*/
|
||||
private boolean mUseWallpaperTextColor;
|
||||
|
||||
/**
|
||||
* Color to be set on this {@link TextView}, when wallpaperTextColor is <b>not</b> utilized.
|
||||
*/
|
||||
@@ -323,9 +316,6 @@ public class Clock extends TextView implements
|
||||
@Override
|
||||
public void onDarkChanged(Rect area, float darkIntensity, int tint) {
|
||||
mNonAdaptedColor = DarkIconDispatcher.getTint(area, this, tint);
|
||||
if (!mUseWallpaperTextColor) {
|
||||
setTextColor(mNonAdaptedColor);
|
||||
}
|
||||
}
|
||||
|
||||
// Update text color based when shade scrim changes color.
|
||||
@@ -347,25 +337,6 @@ public class Clock extends TextView implements
|
||||
0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the clock uses the wallpaperTextColor. If we're not using it, we'll revert back
|
||||
* to dark-mode-based/tinted colors.
|
||||
*
|
||||
* @param shouldUseWallpaperTextColor whether we should use wallpaperTextColor for text color
|
||||
*/
|
||||
public void useWallpaperTextColor(boolean shouldUseWallpaperTextColor) {
|
||||
if (shouldUseWallpaperTextColor == mUseWallpaperTextColor) {
|
||||
return;
|
||||
}
|
||||
mUseWallpaperTextColor = shouldUseWallpaperTextColor;
|
||||
|
||||
if (mUseWallpaperTextColor) {
|
||||
setTextColor(Utils.getColorAttr(mContext, R.attr.wallpaperTextColor));
|
||||
} else {
|
||||
setTextColor(mNonAdaptedColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateShowSeconds() {
|
||||
if (mShowSeconds) {
|
||||
// Wait until we have a display to start trying to show seconds.
|
||||
|
||||
Reference in New Issue
Block a user