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

Commit c834294c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Narrower notification background in large screen portrait shade"

parents 059f5686 baf0d945
Loading
Loading
Loading
Loading
+43 −22
Original line number Diff line number Diff line
@@ -870,7 +870,6 @@ public class NotificationPanelViewController extends PanelViewController
        mPulseExpansionHandler = pulseExpansionHandler;
        mDozeParameters = dozeParameters;
        mScrimController = scrimController;
        mScrimController.setClipsQsScrim(!mShouldUseSplitNotificationShade);
        mUserManager = userManager;
        mMediaDataManager = mediaDataManager;
        mTapAgainViewController = tapAgainViewController;
@@ -1176,7 +1175,6 @@ public class NotificationPanelViewController extends PanelViewController
        int panelWidth = mResources.getDimensionPixelSize(R.dimen.notification_panel_width);
        mShouldUseSplitNotificationShade =
                Utils.shouldUseSplitNotificationShade(mResources);
        mScrimController.setClipsQsScrim(!mShouldUseSplitNotificationShade);
        if (mQs != null) {
            mQs.setInSplitShade(mShouldUseSplitNotificationShade);
        }
@@ -1393,6 +1391,7 @@ public class NotificationPanelViewController extends PanelViewController

    private void setIsFullWidth(boolean isFullWidth) {
        mIsFullWidth = isFullWidth;
        mScrimController.setClipsQsScrim(isFullWidth);
        mNotificationStackScrollLayoutController.setIsFullWidth(isFullWidth);
    }

@@ -2540,15 +2539,23 @@ public class NotificationPanelViewController extends PanelViewController
     * and QS state.
     */
    private void setQSClippingBounds() {
        int top;
        int bottom;
        int left;
        int right;

        final int qsPanelBottomY = calculateQsBottomPosition(computeQsExpansionFraction());
        final boolean qsVisible = (computeQsExpansionFraction() > 0 || qsPanelBottomY > 0);

        if (!mShouldUseSplitNotificationShade) {
        int top = calculateTopQsClippingBound(qsPanelBottomY);
        int bottom = calculateBottomQsClippingBound(top);
        int left = calculateLeftQsClippingBound();
        int right = calculateRightQsClippingBound();
        // top should never be lower than bottom, otherwise it will be invisible.
        top = Math.min(top, bottom);
        applyQSClippingBounds(left, top, right, bottom, qsVisible);
    }

    private int calculateTopQsClippingBound(int qsPanelBottomY) {
        int top;
        if (mShouldUseSplitNotificationShade) {
            top = Math.min(qsPanelBottomY, mSplitShadeStatusBarHeight);
        } else {
            if (mTransitioningToFullShadeProgress > 0.0f) {
                // If we're transitioning, let's use the actual value. The else case
                // can be wrong during transitions when waiting for the keyguard to unlock
@@ -2575,20 +2582,34 @@ public class NotificationPanelViewController extends PanelViewController
                        (getExpandedFraction() - mMinFraction) / (1f - mMinFraction);
                top *= MathUtils.saturate(realFraction / mMinFraction);
            }
            bottom = getView().getBottom();
            // notification bounds should take full screen width regardless of insets
            left = 0;
            right = getView().getRight() + mDisplayRightInset;
        } else {
            top = Math.min(qsPanelBottomY, mSplitShadeStatusBarHeight);
            bottom = top + mNotificationStackScrollLayoutController.getHeight()
        }
        return top;
    }

    private int calculateBottomQsClippingBound(int top) {
        if (mShouldUseSplitNotificationShade) {
            return top + mNotificationStackScrollLayoutController.getHeight()
                    - mSplitShadeNotificationsScrimMarginBottom;
            left = mNotificationStackScrollLayoutController.getLeft();
            right = mNotificationStackScrollLayoutController.getRight();
        } else {
            return getView().getBottom();
        }
    }

    private int calculateLeftQsClippingBound() {
        if (isFullWidth()) {
            // left bounds can ignore insets, it should always reach the edge of the screen
            return 0;
        } else {
            return mNotificationStackScrollLayoutController.getLeft();
        }
    }

    private int calculateRightQsClippingBound() {
        if (isFullWidth()) {
            return getView().getRight() + mDisplayRightInset;
        } else {
            return mNotificationStackScrollLayoutController.getRight();
        }
        // top should never be lower than bottom, otherwise it will be invisible.
        top = Math.min(top, bottom);
        applyQSClippingBounds(left, top, right, bottom, qsVisible);
    }

    private void applyQSClippingBounds(int left, int top, int right, int bottom,
@@ -2645,7 +2666,7 @@ public class NotificationPanelViewController extends PanelViewController
        // Fancy clipping for quick settings
        int radius = mScrimCornerRadius;
        boolean clipStatusView = false;
        if (!mShouldUseSplitNotificationShade) {
        if (isFullWidth()) {
            // The padding on this area is large enough that we can use a cheaper clipping strategy
            mKeyguardStatusAreaClipBounds.set(left, top, right, bottom);
            clipStatusView = qsVisible;
@@ -2808,7 +2829,7 @@ public class NotificationPanelViewController extends PanelViewController
     * shade. 0.0f means we're not transitioning yet.
     */
    public void setTransitionToFullShadeAmount(float pxAmount, boolean animate, long delay) {
        if (animate && !mShouldUseSplitNotificationShade) {
        if (animate && isFullWidth()) {
            animateNextNotificationBounds(StackStateAnimator.ANIMATION_DURATION_GO_TO_FULL_SHADE,
                    delay);
            mIsQsTranslationResetAnimator = mQsTranslationForFullShadeTransition > 0.0f;