checkpoint 3d all apps entrance / exit animations
diff --git a/src/com/android/launcher2/SwipeController.java b/src/com/android/launcher2/SwipeController.java
index 7443b3b..41a02f0 100644
--- a/src/com/android/launcher2/SwipeController.java
+++ b/src/com/android/launcher2/SwipeController.java
@@ -143,6 +143,41 @@
return mTracking || mCanceled;
}
+ /**
+ * Set the value, performing an animation. Make sure that you have set the
+ * range properly first, otherwise the value may be clamped.
+ */
+ public void animate(float dest) {
+ go(dest, 0);
+ }
+
+ /**
+ * Set the value, but don't perform an animation. Make sure that you have set the
+ * range properly first, otherwise the value may be clamped.
+ */
+ public void setImmediate(float dest) {
+ go(dest, dest);
+ }
+
+ /**
+ * Externally start a swipe. If dest == amount, this will end up just immediately
+ * setting the value, but it will perform the proper start and finish callbacks.
+ */
+ private void go(float dest, float amount) {
+ mListener.onStartSwipe();
+
+ dest = clamp(dest);
+ mDirection = dest > amount ? 1 : -1; // if they're equal it doesn't matter
+ mVelocity = mDirection * 0.002f; // TODO: density.
+ mAmount = amount;
+ mDest = dest;
+
+ mFlingTime = SystemClock.uptimeMillis();
+ mLastTime = 0;
+
+ scheduleAnim();
+ }
+
private float clamp(float v) {
if (v < mMinDest) {
return mMinDest;
@@ -165,6 +200,7 @@
mVelocityTracker.computeCurrentVelocity(1);
mVelocity = mVelocityTracker.getYVelocity() / mSwipeDistance;
+ Log.d(TAG, "mVelocity=" + mVelocity);
mDirection = mVelocity >= 0.0f ? 1 : -1;
mAmount = clamp((screenY-mDownY)/mSwipeDistance);
if (mAmount < 0) {