Commit a76f6456 authored by Patrick Noland's avatar Patrick Noland Committed by Commit Bot

[ToolbarMVC] Initialize theme color when ThemeColorProvider is first set

When lazily inflating the MenuButton, the call to setThemeColorProvider
doesn't trigger an immediate update, risking starting with the wrong
color/useLight combination if inflation occurs in a context where the
defaults aren't correct, e.g. incognito. This CL corrects the issue by
initializing the color immediately.

The need for this code should, however,
go away once the color is read from the model instead of directly, since
the initial bind will take care of problems like this.

Bug: 1127826
Change-Id: I609f42427a0b8fa877f4c165e97372d34047f28f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2410590Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Patrick Noland <pnoland@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807051}
parent 7f695532
...@@ -298,6 +298,7 @@ public class MenuButton extends FrameLayout implements TintObserver { ...@@ -298,6 +298,7 @@ public class MenuButton extends FrameLayout implements TintObserver {
public void setThemeColorProvider(ThemeColorProvider themeColorProvider) { public void setThemeColorProvider(ThemeColorProvider themeColorProvider) {
mThemeColorProvider = themeColorProvider; mThemeColorProvider = themeColorProvider;
mThemeColorProvider.addTintObserver(this); mThemeColorProvider.addTintObserver(this);
onTintChanged(themeColorProvider.getTint(), themeColorProvider.useLight());
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment