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

Commit a515d831 authored by Lyn Han's avatar Lyn Han
Browse files

Propagate shade open state from PanelBar to AmbientState

For use in deciding when to fade and clip notifications.

Bug: 172289889
Test: manual

Change-Id: I54d5ba582401ecdae7b3ec43ede89ad05eb33444
parent b1e9252d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public class AmbientState {
    private Runnable mOnPulseHeightChangedListener;
    private ExpandableNotificationRow mTrackedHeadsUpRow;
    private float mAppearFraction;
    private boolean mIsShadeOpening;

    /** Tracks the state from AlertingNotificationManager#hasNotifications() */
    private boolean mHasAlertEntries;
@@ -96,6 +97,14 @@ public class AmbientState {
        mBaseZHeight = getBaseHeight(mZDistanceBetweenElements);
    }

    void setIsShadeOpening(boolean isOpening) {
        mIsShadeOpening = isOpening;
    }

    public boolean isShadeOpening() {
        return mIsShadeOpening;
    }

    private static int getZDistanceBetweenElements(Context context) {
        return Math.max(1, context.getResources()
                .getDimensionPixelSize(R.dimen.z_distance_between_notifications));
+4 −0
Original line number Diff line number Diff line
@@ -550,6 +550,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        }
    }

    void setIsShadeOpening(boolean isOpening) {
        mAmbientState.setIsShadeOpening(isOpening);
    }

    @Override
    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
    protected void onFinishInflate() {
+4 −0
Original line number Diff line number Diff line
@@ -271,6 +271,10 @@ public class NotificationStackScrollLayoutController {
        }
    };

    public void setIsShadeOpening(boolean isOpening) {
        mView.setIsShadeOpening(isOpening);
    }

    private final OnMenuEventListener mMenuEventListener = new OnMenuEventListener() {
        @Override
        public void onMenuClicked(
+5 −0
Original line number Diff line number Diff line
@@ -2411,6 +2411,11 @@ public class NotificationPanelViewController extends PanelViewController {
        setListening(true);
    }

    @Override
    protected void setIsShadeOpening(boolean isOpening) {
        mNotificationStackScrollLayoutController.setIsShadeOpening(isOpening);
    }

    @Override
    protected void setOverExpansion(float overExpansion, boolean isPixels) {
        if (mConflictingQsExpansionGesture || mQsExpandImmediate) {
+3 −0
Original line number Diff line number Diff line
@@ -52,6 +52,9 @@ public abstract class PanelBar extends FrameLayout {
    public void go(int state) {
        if (DEBUG) LOG("go state: %d -> %d", mState, state);
        mState = state;
        if (mPanel != null) {
            mPanel.setIsShadeOpening(state == STATE_OPENING);
        }
    }

    @Override
Loading