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

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

Fixed a bug with overscrolling on the bottom.

When overscrolling on the buttom, we now take the normal rubberband
factor again.

Change-Id: I615c84ee925b69d1ee995a56ffb2e4291c18c43d
parent 466cd7a2
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -968,7 +968,7 @@ public class NotificationStackScrollLayout extends ViewGroup
     * @param animate Should an animation be performed.
     */
    public void setOverScrolledPixels(float numPixels, boolean onTop, boolean animate) {
        setOverScrollAmount(numPixels * getRubberBandFactor(), onTop, animate, true);
        setOverScrollAmount(numPixels * getRubberBandFactor(onTop), onTop, animate, true);
    }

    /**
@@ -1004,7 +1004,7 @@ public class NotificationStackScrollLayout extends ViewGroup
        if (animate) {
            mStateAnimator.animateOverScrollToAmount(amount, onTop);
        } else {
            setOverScrolledPixels(amount / getRubberBandFactor(), onTop);
            setOverScrolledPixels(amount / getRubberBandFactor(onTop), onTop);
            mAmbientState.setOverScrollAmount(amount, onTop);
            if (onTop) {
                notifyOverscrollTopListener(amount);
@@ -1226,13 +1226,14 @@ public class NotificationStackScrollLayout extends ViewGroup
                mOwnScrollY -= (int) topAmount;
                mDontReportNextOverScroll = true;
                setOverScrollAmount(0, true, false);
                mMaxOverScroll = Math.abs(velocityY) / 1000f * getRubberBandFactor()
                mMaxOverScroll = Math.abs(velocityY) / 1000f * getRubberBandFactor(true /* onTop */)
                        * mOverflingDistance + topAmount;
            } else if (velocityY > 0 && bottomAmount > 0) {
                mOwnScrollY += bottomAmount;
                setOverScrollAmount(0, false, false);
                mMaxOverScroll = Math.abs(velocityY) / 1000f * getRubberBandFactor()
                        * mOverflingDistance + bottomAmount;
                mMaxOverScroll = Math.abs(velocityY) / 1000f
                        * getRubberBandFactor(false /* onTop */) * mOverflingDistance
                        +  bottomAmount;
            } else {
                // it will be set once we reach the boundary
                mMaxOverScroll = 0.0f;
@@ -1274,7 +1275,10 @@ public class NotificationStackScrollLayout extends ViewGroup
        return Math.max(desiredPadding, mIntrinsicPadding);
    }

    private float getRubberBandFactor() {
    private float getRubberBandFactor(boolean onTop) {
        if (!onTop) {
            return RUBBER_BAND_FACTOR_NORMAL;
        }
        if (mExpandedInThisMotion) {
            return RUBBER_BAND_FACTOR_AFTER_EXPAND;
        } else if (mIsExpansionChanging) {