From 1d199a630aeb5639f80a0b4ac542c7d0013b24a8 Mon Sep 17 00:00:00 2001 From: Gustav Sennton Date: Thu, 23 May 2019 12:57:03 +0100 Subject: [PATCH] Ensure smart suggestion background color is updated just after inflation Whenever we inflate new smart suggestions we create a new SmartReplyView instance with a default background color. We then use that default color to color our smart suggestion buttons. With this CL we instead fetch the background color of the owning notification (just after the smart suggestions are inflated) to ensure the colors of the smart suggestions are consistent with the color of the notification. Smart Suggestions color update flow: Before this CL: 1. notification update 2. smart suggestions inflated - using SmartReplyView.mDefaultBackgroundColor (white) 3. add SmartReplyView to NotificationContentView -> calls into NotificationContentView.setBackgroundTintColor() now update smart suggestions colors After this CL: 1. notification update 2. smart suggestions inflated - using SmartReplyView.mDefaultBackgroundColor (white) 3. [this CL] update smart suggestion colors 4. add SmartReplyView to NotificationContentView -> calls into NotificationContentView.setBackgroundTintColor() now update smart suggestions colors Bug: 132838369 Test: manual, as per instructions in the bug Change-Id: Ie6fe13b9d01faf4e19b71a15532a1b664617ecbb --- .../notification/row/ActivatableNotificationView.java | 4 ++++ .../statusbar/notification/row/NotificationContentView.java | 2 ++ 2 files changed, 6 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java index c34d567da0beb..87b547e729c05 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java @@ -1045,6 +1045,10 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView return calculateBgColor(false /* withTint */, false /* withOverride */); } + public int getCurrentBackgroundTint() { + return mCurrentBackgroundTint; + } + public boolean isPinned() { return false; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java index 78500357f41f3..63680169b8ae6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java @@ -1437,6 +1437,8 @@ public class NotificationContentView extends FrameLayout { smartReplyView.resetSmartSuggestions(smartReplyContainer); smartReplyView.addPreInflatedButtons( inflatedSmartReplyView.getSmartSuggestionButtons()); + // Ensure the colors of the smart suggestion buttons are up-to-date. + smartReplyView.setBackgroundTintColor(entry.getRow().getCurrentBackgroundTint()); smartReplyContainer.setVisibility(View.VISIBLE); } return smartReplyView;