Merge "Fixing onPageBeginTransition not being called when scrolling overlay" into ub-launcher3-master

This commit is contained in:
Sunny Goyal 2017-01-04 21:57:39 +00:00 committed by Android (Google) Code Review
commit a39a98dac9
2 changed files with 4 additions and 5 deletions

View File

@ -563,7 +563,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
protected boolean computeScrollHelper(boolean shouldInvalidate) { protected boolean computeScrollHelper(boolean shouldInvalidate) {
if (mScroller.computeScrollOffset()) { if (mScroller.computeScrollOffset()) {
// Don't bother scrolling if the page does not need to be moved // Don't bother scrolling if the page does not need to be moved
if (getScrollX() != mScroller.getCurrX() if (getUnboundedScrollX() != mScroller.getCurrX()
|| getScrollY() != mScroller.getCurrY()) { || getScrollY() != mScroller.getCurrY()) {
float scaleX = mFreeScroll ? getScaleX() : 1f; float scaleX = mFreeScroll ? getScaleX() : 1f;
int scrollX = (int) (mScroller.getCurrX() * (1 / scaleX)); int scrollX = (int) (mScroller.getCurrX() * (1 / scaleX));
@ -1945,6 +1945,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
// Trigger a compute() to finish switching pages if necessary // Trigger a compute() to finish switching pages if necessary
if (immediate) { if (immediate) {
computeScroll(); computeScroll();
pageEndTransition();
} }
invalidate(); invalidate();

View File

@ -1386,12 +1386,10 @@ public class Workspace extends PagedView
// it's own settling, and every gesture to the overlay should be self-contained and start // it's own settling, and every gesture to the overlay should be self-contained and start
// from 0, so we zero it out here. // from 0, so we zero it out here.
if (isScrollingOverlay()) { if (isScrollingOverlay()) {
int finalScroll = mIsRtl ? mMaxScrollX : 0;
// We reset mWasInOverscroll so that PagedView doesn't zero out the overscroll // We reset mWasInOverscroll so that PagedView doesn't zero out the overscroll
// interaction when we call scrollTo. // interaction when we call snapToPageImmediately.
mWasInOverscroll = false; mWasInOverscroll = false;
scrollTo(finalScroll, getScrollY()); snapToPageImmediately(0);
} else { } else {
super.snapToDestination(); super.snapToDestination();
} }