Merge "Fix IllegalStateException caused by trying to snap to destination before initalizing page scrolls." into tm-qpr-dev am: 7e1144ee99
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20731930
Change-Id: Ibaa0cad2b3ff673a5d2c83f189e28c4637694ae3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 640736f..5fb33cb 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -1404,15 +1404,17 @@
(isFling && !isVelocityLeft)) && mCurrentPage > 0) {
finalPage = returnToOriginalPage
? mCurrentPage : mCurrentPage - getPanelCount();
- snapToPageWithVelocity(finalPage, velocity);
+ runOnPageScrollsInitialized(
+ () -> snapToPageWithVelocity(finalPage, velocity));
} else if (((isSignificantMove && isDeltaLeft && !isFling) ||
(isFling && isVelocityLeft)) &&
mCurrentPage < getChildCount() - 1) {
finalPage = returnToOriginalPage
? mCurrentPage : mCurrentPage + getPanelCount();
- snapToPageWithVelocity(finalPage, velocity);
+ runOnPageScrollsInitialized(
+ () -> snapToPageWithVelocity(finalPage, velocity));
} else {
- snapToDestination();
+ runOnPageScrollsInitialized(this::snapToDestination);
}
} else {
if (!mScroller.isFinished()) {
@@ -1435,7 +1437,7 @@
int finalPos = mScroller.getFinalX();
mNextPage = getDestinationPage(finalPos);
- onNotSnappingToPageInFreeScroll();
+ runOnPageScrollsInitialized(this::onNotSnappingToPageInFreeScroll);
}
invalidate();
}
@@ -1449,7 +1451,7 @@
case MotionEvent.ACTION_CANCEL:
if (mIsBeingDragged) {
- snapToDestination();
+ runOnPageScrollsInitialized(this::snapToDestination);
}
mEdgeGlowLeft.onRelease();
mEdgeGlowRight.onRelease();