Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d199a63 authored by Gustav Sennton's avatar Gustav Sennton
Browse files

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
parent 2a4e6f6e
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -1045,6 +1045,10 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        return calculateBgColor(false /* withTint */, false /* withOverride */);
        return calculateBgColor(false /* withTint */, false /* withOverride */);
    }
    }


    public int getCurrentBackgroundTint() {
        return mCurrentBackgroundTint;
    }

    public boolean isPinned() {
    public boolean isPinned() {
        return false;
        return false;
    }
    }
+2 −0
Original line number Original line Diff line number Diff line
@@ -1437,6 +1437,8 @@ public class NotificationContentView extends FrameLayout {
            smartReplyView.resetSmartSuggestions(smartReplyContainer);
            smartReplyView.resetSmartSuggestions(smartReplyContainer);
            smartReplyView.addPreInflatedButtons(
            smartReplyView.addPreInflatedButtons(
                    inflatedSmartReplyView.getSmartSuggestionButtons());
                    inflatedSmartReplyView.getSmartSuggestionButtons());
            // Ensure the colors of the smart suggestion buttons are up-to-date.
            smartReplyView.setBackgroundTintColor(entry.getRow().getCurrentBackgroundTint());
            smartReplyContainer.setVisibility(View.VISIBLE);
            smartReplyContainer.setVisibility(View.VISIBLE);
        }
        }
        return smartReplyView;
        return smartReplyView;