From 7a9e58aa17d42c1251b4eea5edf117a4e8b4a6d4 Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Tue, 1 Oct 2013 18:02:13 -0700 Subject: [PATCH] Making sure overview mode can't get stuck (issue 11022017) Change-Id: Iee2088f8781d375b0b83625023fb125a869a2868 --- src/com/android/launcher3/PagedView.java | 25 ++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 0a15ecd62d..6d75018651 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -990,13 +990,14 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc // in accordance with any scroll effects. mForceScreenScrolled = true; mRecomputePageSpacing = true; - + updateFreescrollBounds(); invalidate(); } @Override public void onChildViewRemoved(View parent, View child) { mForceScreenScrolled = true; + updateFreescrollBounds(); invalidate(); } @@ -1558,6 +1559,17 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc setEnableFreeScroll(false, snapPage); } + void updateFreescrollBounds() { + getOverviewModePages(mTempVisiblePagesRange); + if (isLayoutRtl()) { + mFreeScrollMinScrollX = getScrollForPage(mTempVisiblePagesRange[1]); + mFreeScrollMaxScrollX = getScrollForPage(mTempVisiblePagesRange[0]); + } else { + mFreeScrollMinScrollX = getScrollForPage(mTempVisiblePagesRange[0]); + mFreeScrollMaxScrollX = getScrollForPage(mTempVisiblePagesRange[1]); + } + } + private void setEnableFreeScroll(boolean freeScroll, int snapPage) { mFreeScroll = freeScroll; @@ -1565,18 +1577,11 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc snapPage = getPageNearestToCenterOfScreen(); } - getOverviewModePages(mTempVisiblePagesRange); if (!mFreeScroll) { snapToPage(snapPage); } else { - if (isLayoutRtl()) { - mFreeScrollMinScrollX = getScrollForPage(mTempVisiblePagesRange[1]); - mFreeScrollMaxScrollX = getScrollForPage(mTempVisiblePagesRange[0]); - } else { - mFreeScrollMinScrollX = getScrollForPage(mTempVisiblePagesRange[0]); - mFreeScrollMaxScrollX = getScrollForPage(mTempVisiblePagesRange[1]); - } - + updateFreescrollBounds(); + getOverviewModePages(mTempVisiblePagesRange); if (getCurrentPage() < mTempVisiblePagesRange[0]) { setCurrentPage(mTempVisiblePagesRange[0]); } else if (getCurrentPage() > mTempVisiblePagesRange[1]) {