-Added 3D effect to home screen scrolling
-Added background outline fade in / out
-Modified the feel of scrolling: now using quintic
 interpolator and modified the influence of
 scroll velocity

Change-Id: Ifddcab5223ac20be7d9f800ccf09442d9b4db781
diff --git a/src/com/android/launcher2/SmoothPagedView.java b/src/com/android/launcher2/SmoothPagedView.java
index 5f80f25..56037ff 100644
--- a/src/com/android/launcher2/SmoothPagedView.java
+++ b/src/com/android/launcher2/SmoothPagedView.java
@@ -26,11 +26,15 @@
     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;
 
-    private static final float BASELINE_FLING_VELOCITY = 2500.f;
-    private static final float FLING_VELOCITY_INFLUENCE = 0.4f;
+    static final int OVERSHOOT_MODE = 0;
+    static final int QUINTIC_MODE = 1;
 
-    private WorkspaceOvershootInterpolator mScrollInterpolator;
+    int mScrollMode;
+
+    private Interpolator mScrollInterpolator;
 
     private static class WorkspaceOvershootInterpolator implements Interpolator {
         private static final float DEFAULT_TENSION = 1.3f;
@@ -56,6 +60,16 @@
         }
     }
 
+    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.
      *
@@ -83,14 +97,27 @@
         mDeferScrollUpdate = true;
     }
 
+    protected int getScrollMode() {
+        return OVERSHOOT_MODE;
+    }
+
     /**
      * Initializes various states for this workspace.
      */
     @Override
     protected void init() {
         super.init();
-        mScrollInterpolator = new WorkspaceOvershootInterpolator();
-        // overwrite the previous mScroller
+
+        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();
+        }
         mScroller = new Scroller(getContext(), mScrollInterpolator);
     }
 
@@ -112,25 +139,32 @@
         final int screenDelta = Math.max(1, Math.abs(whichPage - mCurrentPage));
         final int newX = getChildOffset(whichPage) - getRelativeChildOffset(whichPage);
         final int delta = newX - mScrollX;
-        int duration = (screenDelta + 1) * 100;
+        int duration;
+        if (mScrollMode == OVERSHOOT_MODE) {
+            duration = (screenDelta + 1) * 100;
+        } else { // QUINTIC_MODE
+            duration = Math.round(Math.abs(delta) * 0.6f);
+        }
 
         if (!mScroller.isFinished()) {
             mScroller.abortAnimation();
         }
 
-        if (settle) {
-            mScrollInterpolator.setDistance(screenDelta);
-        } else {
-            mScrollInterpolator.disableSettle();
+        if (mScrollMode == OVERSHOOT_MODE) {
+            if (settle) {
+                ((WorkspaceOvershootInterpolator) mScrollInterpolator).setDistance(screenDelta);
+            } else {
+                ((WorkspaceOvershootInterpolator) mScrollInterpolator).disableSettle();
+            }
         }
 
         velocity = Math.abs(velocity);
         if (velocity > 0) {
-            duration += (duration / (velocity / BASELINE_FLING_VELOCITY))
-                    * FLING_VELOCITY_INFLUENCE;
+            duration += (duration / (velocity / mBaseLineFlingVelocity)) * mFlingVelocityInfluence;
         } else {
             duration += 100;
         }
+
         snapToPage(whichPage, delta, duration);
     }