diff options
Diffstat (limited to 'src/com/android/launcher3/PagedView.java')
-rw-r--r-- | src/com/android/launcher3/PagedView.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 8716a33be..abf8bbd14 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -89,6 +89,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc protected boolean mFirstLayout = true; protected int mCurrentPage; + protected int mChildCountOnLastMeasure; + protected int mNextPage = INVALID_PAGE; protected int mMaxScrollX; protected Scroller mScroller; @@ -347,7 +349,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc return; } - + mForceScreenScrolled = true; mCurrentPage = Math.max(0, Math.min(currentPage, getPageCount() - 1)); updateCurrentPageScroll(); updateScrollingIndicator(); @@ -564,6 +566,11 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc // ensure that the cache is filled with good values. invalidateCachedOffsets(); + if (mChildCountOnLastMeasure != getChildCount()) { + setCurrentPage(mCurrentPage); + } + mChildCountOnLastMeasure = getChildCount(); + if (childCount > 0) { if (DEBUG) Log.d(TAG, "getRelativeChildOffset(): " + getMeasuredWidth() + ", " + getChildWidth(0)); |