summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lucas Dupin <dupin@google.com> 2021-01-26 23:01:24 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-01-26 23:01:24 +0000
commit0c38b48c3f0de62de7661ff239936004a2d24893 (patch)
tree66bdd7a9d5affd4f09aa1c283649829bc890725c
parentdcd581fdc1bebe2e577599461a68238b2f22cf68 (diff)
parent1530f117585d22e7d2ec9293fec20ae8c183331d (diff)
Merge "Fix staus bar colors when shade is down"
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java38
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java29
2 files changed, 16 insertions, 51 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index b85ad8195edd..4248cf2efcd0 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -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);
-
- 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);
+
+ updateResources();
+
// 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();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
index fbbf362f19d1..d097cfadd265 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
@@ -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;
@@ -102,12 +101,6 @@ public class Clock extends TextView implements
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.
*/
private int mNonAdaptedColor;
@@ -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.