Clamping maximum overscroll amount

- It was possible to crash launcher if you pulled really really far
  to the right

Change-Id: I3ec45c7cbda2c4036e2e2359f2aa617ce7091bcd
This commit is contained in:
Adam Cohen
2011-01-28 13:52:37 -08:00
parent 860f4c5a82
commit 7bfc979594
+5
View File
@@ -879,6 +879,11 @@ public abstract class PagedView extends ViewGroup {
if (f == 0) return;
f = f / (Math.abs(f)) * (overScrollInfluenceCurve(Math.abs(f)));
// Clamp this factor, f, to -1 < f < 1
if (Math.abs(f) >= 1) {
f /= Math.abs(f);
}
int overScrollAmount = (int) Math.round(OVERSCROLL_DAMP_FACTOR * f * screenSize);
if (amount < 0) {
mScrollX = overScrollAmount;