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

Commit 9d1186b4 authored by Beverly's avatar Beverly Committed by android-build-merger
Browse files

Merge "Update notification shade text on zen change" into pi-dev am: 7468d361

am: ab334fd6

Change-Id: I79dad6deea669e3953b912e78fcaf5f20511896c
parents 035e6b9c ab334fd6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -62,6 +62,10 @@ public class EmptyShadeView extends StackScrollerDecorView {
        mEmptyText.setText(mText);
    }

    public int getTextResource() {
        return mText;
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
+6 −0
Original line number Diff line number Diff line
@@ -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,
+12 −4
Original line number Diff line number Diff line
@@ -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);
                }
            } else {
                hideFooterView(mEmptyShadeView, true);
            }
+13 −0
Original line number Diff line number Diff line
@@ -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() {