Fixing bug with Launcher page scrolling
Change-Id: Ib9a5a77ffe40dfcde0f846558e5ef0441cb11f7f
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 0772c0a..2cd7f20 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -877,7 +877,7 @@
return offset;
}
- protected void snapToDestination() {
+ int getPageNearestToCenterOfScreen() {
int minDistanceFromScreenCenter = getMeasuredWidth();
int minDistanceFromScreenCenterIndex = -1;
int screenCenter = mScrollX + (getMeasuredWidth() / 2);
@@ -893,7 +893,11 @@
minDistanceFromScreenCenterIndex = i;
}
}
- snapToPage(minDistanceFromScreenCenterIndex, PAGE_SNAP_ANIMATION_DURATION);
+ return minDistanceFromScreenCenterIndex;
+ }
+
+ protected void snapToDestination() {
+ snapToPage(getPageNearestToCenterOfScreen(), PAGE_SNAP_ANIMATION_DURATION);
}
protected void snapToPageWithVelocity(int whichPage, int velocity) {