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

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

Fixed the maxPanelheight on the lockscreen

Previously the maxPanelHeight was depending
on the actual position also including the current
expand position. That could lead to flickering
and the hint animation being wrong.

Bug: 130327302
Test: expand and collapse panel, perform hint while dismiss function is enabled
Change-Id: I606690898a52a1999c391888149d490f20a0b9cb
parent c1d9ab22
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -804,7 +804,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
                canvas.drawLine(0, y, getWidth(), y, mDebugPaint);
            }
            canvas.drawText(Integer.toString(getMaxNegativeScrollAmount()), getWidth() - 100,
                    getIntrinsicPadding() + 30, mDebugPaint);
                    getTopPadding() + 30, mDebugPaint);
            canvas.drawText(Integer.toString(getMaxPositiveScrollAmount()), getWidth() - 100,
                    getHeight() - 30, mDebugPaint);
        }
@@ -2400,7 +2400,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        }
        mIntrinsicContentHeight = height;

        mContentHeight = height + mTopPadding + mBottomMargin;
        // The topPadding can be bigger than the regular padding when qs is expanded, in that
        // state the maxPanelHeight and the contentHeight should be bigger
        mContentHeight = height + Math.max(mIntrinsicPadding, mTopPadding) + mBottomMargin;
        updateScrollability();
        clampScrollPosition();
        mAmbientState.setLayoutMaxHeight(mContentHeight);
@@ -2785,12 +2787,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
     *
     * @param qsHeight               the top padding imposed by the quick settings panel
     * @param animate                whether to animate the change
     * @param ignoreIntrinsicPadding if true, {@link #getIntrinsicPadding()} is ignored and
     *                               {@code qsHeight} is the final top padding
     */
    @ShadeViewRefactor(RefactorComponent.COORDINATOR)
    public void updateTopPadding(float qsHeight, boolean animate,
            boolean ignoreIntrinsicPadding) {
    public void updateTopPadding(float qsHeight, boolean animate) {
        int topPadding = (int) qsHeight;
        int minStackHeight = getLayoutMinHeight();
        if (topPadding + minStackHeight > getHeight()) {
@@ -2798,8 +2797,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        } else {
            mTopPaddingOverflow = 0;
        }
        setTopPadding(ignoreIntrinsicPadding ? topPadding : clampPadding(topPadding),
                animate);
        setTopPadding(topPadding, animate);
        setExpandedHeight(mExpandedHeight);
    }

+9 −3
Original line number Diff line number Diff line
@@ -155,10 +155,11 @@ public class KeyguardClockPositionAlgorithm {
    }

    public void run(Result result) {
        final int y = getClockY();
        final int y = getClockY(mPanelExpansion);
        result.clockY = y;
        result.clockAlpha = getClockAlpha(y);
        result.stackScrollerPadding = y + mKeyguardStatusHeight;
        result.stackScrollerPaddingExpanded = getClockY(1.0f) + mKeyguardStatusHeight;
        result.clockX = (int) interpolate(0, burnInPreventionOffsetX(), mDarkAmount);
    }

@@ -203,7 +204,7 @@ public class KeyguardClockPositionAlgorithm {
        return (int) y;
    }

    private int getClockY() {
    private int getClockY(float panelExpansion) {
        // Dark: Align the bottom edge of the clock at about half of the screen:
        float clockYDark = (mHasCustomClock ? getPreferredClockY() : getMaxClockY())
                + burnInPreventionOffsetY();
@@ -213,7 +214,7 @@ public class KeyguardClockPositionAlgorithm {
        float clockYBouncer = -mKeyguardStatusHeight;

        // Move clock up while collapsing the shade
        float shadeExpansion = Interpolators.FAST_OUT_LINEAR_IN.getInterpolation(mPanelExpansion);
        float shadeExpansion = Interpolators.FAST_OUT_LINEAR_IN.getInterpolation(panelExpansion);
        float clockY = MathUtils.lerp(clockYBouncer, clockYRegular, shadeExpansion);
        clockYDark = MathUtils.lerp(clockYBouncer, clockYDark, shadeExpansion);

@@ -266,5 +267,10 @@ public class KeyguardClockPositionAlgorithm {
         * The top padding of the stack scroller, in pixels.
         */
        public int stackScrollerPadding;

        /**
         * The top padding of the stack scroller, in pixels when fully expanded.
         */
        public int stackScrollerPaddingExpanded;
    }
}
+3 −5
Original line number Diff line number Diff line
@@ -666,7 +666,7 @@ public class NotificationPanelView extends PanelView implements
            PropertyAnimator.setProperty(mKeyguardStatusView, AnimatableProperty.Y,
                    mClockPositionResult.clockY, CLOCK_ANIMATION_PROPERTIES, animateClock);
            updateClock();
            stackScrollerPadding = mClockPositionResult.stackScrollerPadding;
            stackScrollerPadding = mClockPositionResult.stackScrollerPaddingExpanded;
        }
        mNotificationStackScroller.setIntrinsicPadding(stackScrollerPadding);
        mNotificationStackScroller.setAntiBurnInOffsetX(mClockPositionResult.clockX);
@@ -1601,7 +1601,7 @@ public class NotificationPanelView extends PanelView implements
        } else if (mKeyguardShowing) {
            // We can only do the smoother transition on Keyguard when we also are not collapsing
            // from a scrolled quick settings.
            return MathUtils.lerp((float) mNotificationStackScroller.getIntrinsicPadding(),
            return MathUtils.lerp((float) mClockPositionResult.stackScrollerPadding,
                    (float) (mQsMaxExpansionHeight + mQsNotificationTopPadding),
                    getQsExpansionFraction());
        } else {
@@ -1610,9 +1610,7 @@ public class NotificationPanelView extends PanelView implements
    }

    protected void requestScrollerTopPaddingUpdate(boolean animate) {
        mNotificationStackScroller.updateTopPadding(calculateQsTopPadding(),
                animate, mKeyguardShowing
                        && (mQsExpandImmediate || mIsExpanding && mQsExpandedWhenExpandingStarted));
        mNotificationStackScroller.updateTopPadding(calculateQsTopPadding(), animate);
    }

    private void trackMovement(MotionEvent event) {