diff options
author | Adam Cohen <adamcohen@google.com> | 2010-09-29 13:02:43 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2010-09-29 13:04:32 -0700 |
commit | 0fb7db5a3771223bc86fdf0e01665e69c1309cc1 (patch) | |
tree | 032c664a02611f0820e1d85f21d898844c3e812a /src/com/android/launcher2/SmoothPagedView.java | |
parent | de7658b5e02ae10010e44fcf8d9c5814f54d9eb0 (diff) | |
download | packages_apps_trebuchet-0fb7db5a3771223bc86fdf0e01665e69c1309cc1.zip packages_apps_trebuchet-0fb7db5a3771223bc86fdf0e01665e69c1309cc1.tar.gz packages_apps_trebuchet-0fb7db5a3771223bc86fdf0e01665e69c1309cc1.tar.bz2 |
Fixing boot stall.
Revert "-Added 3D effect to home screen scrolling"
This reverts commit 9415d87eda0cf28b8df1eccde39b0ca1646be3b9.
Change-Id: Ib8d6602f5d82884eb1f6cc44c0cc71cc563a3a59
Diffstat (limited to 'src/com/android/launcher2/SmoothPagedView.java')
-rw-r--r-- | src/com/android/launcher2/SmoothPagedView.java | 58 |
1 files changed, 12 insertions, 46 deletions
diff --git a/src/com/android/launcher2/SmoothPagedView.java b/src/com/android/launcher2/SmoothPagedView.java index 56037ff..5f80f25 100644 --- a/src/com/android/launcher2/SmoothPagedView.java +++ b/src/com/android/launcher2/SmoothPagedView.java @@ -26,15 +26,11 @@ public abstract class SmoothPagedView extends PagedView { private static final float SMOOTHING_SPEED = 0.75f; private static final float SMOOTHING_CONSTANT = (float) (0.016 / Math.log(SMOOTHING_SPEED)); - private float mBaseLineFlingVelocity; - private float mFlingVelocityInfluence; - static final int OVERSHOOT_MODE = 0; - static final int QUINTIC_MODE = 1; + private static final float BASELINE_FLING_VELOCITY = 2500.f; + private static final float FLING_VELOCITY_INFLUENCE = 0.4f; - int mScrollMode; - - private Interpolator mScrollInterpolator; + private WorkspaceOvershootInterpolator mScrollInterpolator; private static class WorkspaceOvershootInterpolator implements Interpolator { private static final float DEFAULT_TENSION = 1.3f; @@ -60,16 +56,6 @@ public abstract class SmoothPagedView extends PagedView { } } - private static class QuinticInterpolator implements Interpolator { - public QuinticInterpolator() { - } - - public float getInterpolation(float t) { - t -= 1.0f; - return t*t*t*t*t + 1; - } - } - /** * Used to inflate the Workspace from XML. * @@ -97,27 +83,14 @@ public abstract class SmoothPagedView extends PagedView { mDeferScrollUpdate = true; } - protected int getScrollMode() { - return OVERSHOOT_MODE; - } - /** * Initializes various states for this workspace. */ @Override protected void init() { super.init(); - - mScrollMode = getScrollMode(); - if (mScrollMode == QUINTIC_MODE) { - mBaseLineFlingVelocity = 700.0f; - mFlingVelocityInfluence = 0.8f; - mScrollInterpolator = new QuinticInterpolator(); - } else { // QUINTIC_MODE - mBaseLineFlingVelocity = 2500.0f; - mFlingVelocityInfluence = 0.4f; - mScrollInterpolator = new WorkspaceOvershootInterpolator(); - } + mScrollInterpolator = new WorkspaceOvershootInterpolator(); + // overwrite the previous mScroller mScroller = new Scroller(getContext(), mScrollInterpolator); } @@ -139,32 +112,25 @@ 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; - int duration; - if (mScrollMode == OVERSHOOT_MODE) { - duration = (screenDelta + 1) * 100; - } else { // QUINTIC_MODE - duration = Math.round(Math.abs(delta) * 0.6f); - } + int duration = (screenDelta + 1) * 100; if (!mScroller.isFinished()) { mScroller.abortAnimation(); } - if (mScrollMode == OVERSHOOT_MODE) { - if (settle) { - ((WorkspaceOvershootInterpolator) mScrollInterpolator).setDistance(screenDelta); - } else { - ((WorkspaceOvershootInterpolator) mScrollInterpolator).disableSettle(); - } + if (settle) { + mScrollInterpolator.setDistance(screenDelta); + } else { + mScrollInterpolator.disableSettle(); } velocity = Math.abs(velocity); if (velocity > 0) { - duration += (duration / (velocity / mBaseLineFlingVelocity)) * mFlingVelocityInfluence; + duration += (duration / (velocity / BASELINE_FLING_VELOCITY)) + * FLING_VELOCITY_INFLUENCE; } else { duration += 100; } - snapToPage(whichPage, delta, duration); } |