diff options
author | Adam Cohen <adamcohen@google.com> | 2010-11-15 10:50:58 -0800 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2010-11-18 16:32:19 -0800 |
commit | 68d739365bf650fe7fecf99cd3bfe63a0d41bd12 (patch) | |
tree | dff870226d43c0751c70c3b3f4c98e6c8efc45f5 /src/com/android/launcher2/SmoothPagedView.java | |
parent | c0bd58837acbb7e7e879437192b818e03ac02ff3 (diff) | |
download | packages_apps_trebuchet-68d739365bf650fe7fecf99cd3bfe63a0d41bd12.zip packages_apps_trebuchet-68d739365bf650fe7fecf99cd3bfe63a0d41bd12.tar.gz packages_apps_trebuchet-68d739365bf650fe7fecf99cd3bfe63a0d41bd12.tar.bz2 |
Adding overscroll to Workspace, AllApps and Customize
-Also modified the background alpha interpolation during scrolling
Change-Id: I68db8fbe80f720c507ab3208d8b3dcd8aa4f2081
Diffstat (limited to 'src/com/android/launcher2/SmoothPagedView.java')
-rw-r--r-- | src/com/android/launcher2/SmoothPagedView.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/com/android/launcher2/SmoothPagedView.java b/src/com/android/launcher2/SmoothPagedView.java index 8e729e4..ee8bca2 100644 --- a/src/com/android/launcher2/SmoothPagedView.java +++ b/src/com/android/launcher2/SmoothPagedView.java @@ -138,7 +138,7 @@ public abstract class SmoothPagedView extends PagedView { final int screenDelta = Math.max(1, Math.abs(whichPage - mCurrentPage)); final int newX = getChildOffset(whichPage) - getRelativeChildOffset(whichPage); - final int delta = newX - mScrollX; + final int delta = newX - mUnboundedScrollX; int duration; if (mScrollMode == OVERSHOOT_MODE) { duration = (screenDelta + 1) * 100; @@ -180,8 +180,9 @@ public abstract class SmoothPagedView extends PagedView { if (!scrollComputed && mTouchState == TOUCH_STATE_SCROLLING) { final float now = System.nanoTime() / NANOTIME_DIV; final float e = (float) Math.exp((now - mSmoothingTime) / SMOOTHING_CONSTANT); - final float dx = mTouchX - mScrollX; - mScrollX += dx * e; + + final float dx = mTouchX - mUnboundedScrollX; + scrollTo(Math.round(mUnboundedScrollX + dx * e), mScrollY); mSmoothingTime = now; // Keep generating points as long as we're more than 1px away from the target @@ -189,5 +190,6 @@ public abstract class SmoothPagedView extends PagedView { invalidate(); } } + } } |