From fed1ab62223980cebbea8a9148a695159389169f Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Tue, 17 Jun 2014 14:10:33 -0700 Subject: [PATCH] Fixed a bug with overscrolling on the bottom. When overscrolling on the buttom, we now take the normal rubberband factor again. Change-Id: I615c84ee925b69d1ee995a56ffb2e4291c18c43d --- .../stack/NotificationStackScrollLayout.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 4e1b68643169f..22cff16bfa9fc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -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) {