Add color change listener to NSSL

Adds a ColorExtractor.OnColorsChangedListener to the
NotificiationStackScrollLayout. Move some of the related code from
onThemeChanged to the new listener so that it gets all the same
calls that the ScrimController gets when the wallpaper changes.

Bug: 150143437
Test: manual
Change-Id: I687f606ea28e699dc46df8c08af13010c41d6ae2
This commit is contained in:
Dave Mankoff
2020-05-29 14:25:05 -04:00
parent c119ee1ed2
commit 853ae8c67e

View File

@@ -535,6 +535,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
private int mWaterfallTopInset;
private SysuiColorExtractor.OnColorsChangedListener mOnColorsChangedListener =
(colorExtractor, which) -> {
final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
updateDecorViews(useDarkText);
};
@Inject
public NotificationStackScrollLayout(
@Named(VIEW_CONTEXT) Context context,
@@ -662,6 +668,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
mStatusbarStateController = statusBarStateController;
initializeForegroundServiceSection(fgsFeatureController);
mUiEventLogger = uiEventLogger;
mColorExtractor.addOnColorsChangedListener(mOnColorsChangedListener);
}
private void initializeForegroundServiceSection(
@@ -728,9 +735,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
@Override
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void onThemeChanged() {
final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
updateDecorViews(useDarkText);
updateFooter();
}