summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/PagedView.java
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2015-09-08 10:35:56 -0700
committerTony Wickham <twickham@google.com>2015-09-09 09:25:51 -0700
commit29d853c2ddf6432685a54e3966820f1a81cee183 (patch)
treed4bcdda6a5326604dbc73bf1ed20538e55711894 /src/com/android/launcher3/PagedView.java
parent86fb39930928159bd1210404e6f973060272a648 (diff)
downloadandroid_packages_apps_Trebuchet-29d853c2ddf6432685a54e3966820f1a81cee183.tar.gz
android_packages_apps_Trebuchet-29d853c2ddf6432685a54e3966820f1a81cee183.tar.bz2
android_packages_apps_Trebuchet-29d853c2ddf6432685a54e3966820f1a81cee183.zip
Make sure all overlay panels are visible as user free scrolls.
Previously there was a workaround to ensure that adjacent panels were visible while in the overview or spring-loaded states, but it incorrectly kept only those original pages visible even while the user scrolled to other pages. So now we only use the workaround when first entering the overview or spring-loaded states, and then fall back to the default getVisiblePages() implementation in PageView when in free scoll mode. Bug: 23766408 Change-Id: I692ec00b9cd6d7889c374aee41b85abd0a5d8d3c
Diffstat (limited to 'src/com/android/launcher3/PagedView.java')
-rw-r--r--src/com/android/launcher3/PagedView.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 5d2e1ccc4..5f54e1d14 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -372,7 +372,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
/**
- * Returns the index of the currently displayed page.
+ * Returns the index of the currently displayed page. When in free scroll mode, this is the page
+ * that the user was on before entering free scroll mode (e.g. the home screen page they
+ * long-pressed on to enter the overview). Try using {@link #getPageNearestToCenterOfScreen()}
+ * to get the page the user is currently scrolling over.
*/
public int getCurrentPage() {
return mCurrentPage;
@@ -1039,11 +1042,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
if (pageCount > 0) {
int viewportWidth = getViewportWidth();
- int curScreen = 0;
+ int lastVisiblePageIndex = 0;
- int count = getChildCount();
- for (int i = 0; i < count; i++) {
- View currPage = getPageAt(i);
+ for (int currPageIndex = 0; currPageIndex < pageCount; currPageIndex++) {
+ View currPage = getPageAt(currPageIndex);
sTmpIntPoint[0] = 0;
Utilities.getDescendantCoordRelativeToParent(currPage, this, sTmpIntPoint, false);
@@ -1064,13 +1066,13 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
break;
}
}
- curScreen = i;
if (range[0] < 0) {
- range[0] = curScreen;
+ range[0] = currPageIndex;
}
+ lastVisiblePageIndex = currPageIndex;
}
- range[1] = curScreen;
+ range[1] = lastVisiblePageIndex;
} else {
range[0] = -1;
range[1] = -1;