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

Commit f0c79e10 authored by Selim Cinek's avatar Selim Cinek
Browse files

Keeping the header hidden while the hun is going away

Previously we were showing the Hun header immediately again
when the heads up times out, but we now also factor in
if it's animating away.

Test: add hun, click on it, header is still hidden
Change-Id: I2e5714c9282f0dd76d17511485c002010be169bb
Fixes: 	77219603
parent 150bafd2
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ import java.util.function.Consumer;
/**
 * Controls the appearance of heads up notifications in the icon area and the header itself.
 */
class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
        DarkIconDispatcher.DarkReceiver {
    public static final int CONTENT_FADE_DURATION = 110;
    public static final int CONTENT_FADE_DELAY = 100;
@@ -92,6 +92,7 @@ class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
        panelView.setHeadsUpAppearanceController(this);
        mStackScroller.addOnExpandedHeightListener(mSetExpandedHeight);
        mStackScroller.addOnLayoutChangeListener(mStackScrollLayoutChangeListener);
        mStackScroller.setHeadsUpAppearanceController(this);
        mClockView = clockView;
        mDarkIconDispatcher = Dependency.get(DarkIconDispatcher.class);
        mDarkIconDispatcher.addDarkReceiver(this);
@@ -226,10 +227,10 @@ class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
        });
    }

    private void updateHeader(NotificationData.Entry entry) {
    public void updateHeader(NotificationData.Entry entry) {
        ExpandableNotificationRow row = entry.row;
        float headerVisibleAmount = 1.0f;
        if (row.isPinned() || row == mTrackedChild) {
        if (row.isPinned() || row.isHeadsUpAnimatingAway() || row == mTrackedChild) {
            headerVisibleAmount = mExpandFraction;
        }
        row.setHeaderVisibleAmount(headerVisibleAmount);
+11 −2
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ import com.android.systemui.statusbar.notification.FakeShadowView;
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.VisibilityLocationProvider;
import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.statusbar.phone.HeadsUpAppearanceController;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.ScrimController;
@@ -416,6 +417,7 @@ public class NotificationStackScrollLayout extends ViewGroup
    private int mAntiBurnInOffsetX;
    private ArrayList<BiConsumer<Float, Float>> mExpandedHeightListeners = new ArrayList<>();
    private int mHeadsUpInset;
    private HeadsUpAppearanceController mHeadsUpAppearanceController;

    public NotificationStackScrollLayout(Context context) {
        this(context, null);
@@ -3078,8 +3080,10 @@ public class NotificationStackScrollLayout extends ViewGroup

    @Override
    public void bindRow(ExpandableNotificationRow row) {
        row.setHeadsUpAnimatingAwayListener(animatingAway
                -> mRoundnessManager.onHeadsupAnimatingAwayChanged(row, animatingAway));
        row.setHeadsUpAnimatingAwayListener(animatingAway -> {
            mRoundnessManager.onHeadsupAnimatingAwayChanged(row, animatingAway);
            mHeadsUpAppearanceController.updateHeader(row.getEntry());
        });
    }

    @Override
@@ -4653,6 +4657,11 @@ public class NotificationStackScrollLayout extends ViewGroup
        mExpandedHeightListeners.remove(listener);
    }

    public void setHeadsUpAppearanceController(
            HeadsUpAppearanceController headsUpAppearanceController) {
        mHeadsUpAppearanceController = headsUpAppearanceController;
    }

    /**
     * A listener that is notified when the empty space below the notifications is clicked on
     */