Fixing state transition bugs

- explicitly keeping track of state in Workspace
- cancelling animations before starting new ones
- adding additional state variable for workspace for in-progress transitions
- updating Scroller object if we jump to a certain location

Change-Id: I5ddf51bae543ec89b2a44ab651d7269eb4859a6d
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index bf0eb12..578bbcc 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -242,7 +242,9 @@
         if (getChildCount() == 0) return;
 
         mCurrentPage = Math.max(0, Math.min(currentPage, getPageCount() - 1));
-        scrollTo(getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage), 0);
+        int newX = getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage);
+        scrollTo(newX, 0);
+        mScroller.setFinalX(newX);
 
         invalidate();
         notifyPageSwitchListener();