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
This commit is contained in:
Michael Jurka
2010-10-06 16:41:29 -07:00
parent 1262e36948
commit c0e8fcae49
3 changed files with 97 additions and 83 deletions
+3 -1
View File
@@ -242,7 +242,9 @@ public abstract class PagedView extends ViewGroup {
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();