Update header color for all bubbles
Bubble stack view - after dark mode change, update expanded view header color for all bubbles
Previously, mContext.getColor(R.attr.colorAccent) updated header color in a hacky way:
colorAccent was *not* a color => ResourcesNotFoundException => all bubbles re-inflated with the correct new color
Bug: 123829494
Test: manual
Change-Id: I526d6f91d032b24424740d93c3eec7776c1e0c44
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index 559c9f6..de887ff 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -381,10 +381,18 @@
}
/**
- * Update bubble expanded view header when user toggles dark mode.
+ * Update header color when user toggles dark mode.
*/
void updateHeaderColor() {
- mHeaderView.setBackgroundColor(mContext.getColor(R.attr.colorAccent));
+ TypedArray ta = mContext.obtainStyledAttributes(
+ new int[] {android.R.attr.colorBackgroundFloating, android.R.attr.colorForeground});
+ int bgColor = ta.getColor(0, Color.WHITE /* default */);
+ int btnColor = ta.getColor(1, Color.BLACK /* default */);
+ ta.recycle();
+
+ mHeaderView.setBackgroundColor(bgColor);
+ mSettingsIcon.setColorFilter(btnColor);
+ mDeepLinkIcon.setColorFilter(btnColor);
}
private void updateHeaderView() {
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index 617090a..128ec91 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -270,8 +270,8 @@
* Handle config changes.
*/
public void onConfigChanged() {
- if (mExpandedBubble != null) {
- mExpandedBubble.expandedView.updateHeaderColor();
+ for (Bubble b: mBubbleData.getBubbles()) {
+ b.expandedView.updateHeaderColor();
}
}
@@ -856,7 +856,6 @@
private void applyCurrentState() {
Log.d(TAG, "applyCurrentState: mIsExpanded=" + mIsExpanded);
-
mExpandedViewContainer.setVisibility(mIsExpanded ? VISIBLE : GONE);
if (mIsExpanded) {
// First update the view so that it calculates a new height (ensuring the y position