Merge "Update notification shade text on zen change" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7468d361e3
@@ -62,6 +62,10 @@ public class EmptyShadeView extends StackScrollerDecorView {
|
||||
mEmptyText.setText(mText);
|
||||
}
|
||||
|
||||
public int getTextResource() {
|
||||
return mText;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
@@ -784,6 +784,12 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
// into fragments, but the rest here, it leaves some awkward lifecycle and whatnot.
|
||||
mNotificationPanel = mStatusBarWindow.findViewById(R.id.notification_panel);
|
||||
mStackScroller = mStatusBarWindow.findViewById(R.id.notification_stack_scroller);
|
||||
mZenController.addCallback(new ZenModeController.Callback() {
|
||||
@Override
|
||||
public void onZenChanged(int zen) {
|
||||
updateEmptyShadeView();
|
||||
}
|
||||
});
|
||||
mActivityLaunchAnimator = new ActivityLaunchAnimator(mStatusBarWindow,
|
||||
this,
|
||||
mNotificationPanel,
|
||||
|
||||
@@ -111,6 +111,7 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
@@ -4039,14 +4040,21 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
public void updateEmptyShadeView(boolean visible) {
|
||||
int oldVisibility = mEmptyShadeView.willBeGone() ? GONE : mEmptyShadeView.getVisibility();
|
||||
int newVisibility = visible ? VISIBLE : GONE;
|
||||
if (oldVisibility != newVisibility) {
|
||||
|
||||
boolean changedVisibility = oldVisibility != newVisibility;
|
||||
if (changedVisibility || newVisibility != GONE) {
|
||||
if (newVisibility != GONE) {
|
||||
int oldText = mEmptyShadeView.getTextResource();
|
||||
int newText;
|
||||
if (mStatusBar.areNotificationsHidden()) {
|
||||
mEmptyShadeView.setText(R.string.dnd_suppressing_shade_text);
|
||||
newText = R.string.dnd_suppressing_shade_text;
|
||||
} else {
|
||||
mEmptyShadeView.setText(R.string.empty_shade_text);
|
||||
newText = R.string.empty_shade_text;
|
||||
}
|
||||
if (changedVisibility || !Objects.equals(oldText, newText)) {
|
||||
mEmptyShadeView.setText(newText);
|
||||
showFooterView(mEmptyShadeView);
|
||||
}
|
||||
showFooterView(mEmptyShadeView);
|
||||
} else {
|
||||
hideFooterView(mEmptyShadeView, true);
|
||||
}
|
||||
|
||||
@@ -140,6 +140,19 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
||||
verify(mEmptyShadeView).setText(R.string.empty_shade_text);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateEmptyView_noNotificationsToDndSuppressing() {
|
||||
mStackScroller.setEmptyShadeView(mEmptyShadeView);
|
||||
when(mEmptyShadeView.willBeGone()).thenReturn(true);
|
||||
when(mBar.areNotificationsHidden()).thenReturn(false);
|
||||
mStackScroller.updateEmptyShadeView(true);
|
||||
verify(mEmptyShadeView).setText(R.string.empty_shade_text);
|
||||
|
||||
when(mBar.areNotificationsHidden()).thenReturn(true);
|
||||
mStackScroller.updateEmptyShadeView(true);
|
||||
verify(mEmptyShadeView).setText(R.string.dnd_suppressing_shade_text);
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void testSetExpandedHeight_blockingHelperManagerReceivedCallbacks() {
|
||||
|
||||
Reference in New Issue
Block a user