Fix edge case where LauncherOverlay scroll woudln't be reset
-> If the Workspace has a single page and the user goes from overscrolling in one direction, and then the other, the LauncherOverlay scroll wouldn't be set to 0 until the scrolling settled Change-Id: I29ee9abdfa023ae3599d1590cdaebf457e2220fa
This commit is contained in:
parent
be25822f76
commit
8c4ca9277d
|
@ -295,6 +295,7 @@ public class Workspace extends SmoothPagedView
|
||||||
boolean mScrollInteractionBegan;
|
boolean mScrollInteractionBegan;
|
||||||
boolean mStartedSendingScrollEvents;
|
boolean mStartedSendingScrollEvents;
|
||||||
boolean mShouldSendPageSettled;
|
boolean mShouldSendPageSettled;
|
||||||
|
int mLastOverlaySroll = 0;
|
||||||
|
|
||||||
private final Runnable mBindPages = new Runnable() {
|
private final Runnable mBindPages = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1287,8 +1288,11 @@ public class Workspace extends SmoothPagedView
|
||||||
boolean shouldOverScroll = (amount <= 0 && (!hasCustomContent() || isRtl)) ||
|
boolean shouldOverScroll = (amount <= 0 && (!hasCustomContent() || isRtl)) ||
|
||||||
(amount >= 0 && (!hasCustomContent() || !isRtl));
|
(amount >= 0 && (!hasCustomContent() || !isRtl));
|
||||||
|
|
||||||
boolean shouldScrollOverlay = (amount <= 0 && mLauncherOverlay != null && !isRtl) ||
|
boolean shouldScrollOverlay = mLauncherOverlay != null &&
|
||||||
(amount >= 0 && mLauncherOverlay != null && isRtl);
|
((amount <= 0 && !isRtl) || (amount >= 0 && isRtl));
|
||||||
|
|
||||||
|
boolean shouldZeroOverlay = mLauncherOverlay != null && mLastOverlaySroll != 0 &&
|
||||||
|
((amount >= 0 && !isRtl) || (amount <= 0 && isRtl));
|
||||||
|
|
||||||
if (shouldScrollOverlay) {
|
if (shouldScrollOverlay) {
|
||||||
if (!mStartedSendingScrollEvents && mScrollInteractionBegan) {
|
if (!mStartedSendingScrollEvents && mScrollInteractionBegan) {
|
||||||
|
@ -1301,6 +1305,7 @@ public class Workspace extends SmoothPagedView
|
||||||
|
|
||||||
int progress = (int) Math.abs((f * 100));
|
int progress = (int) Math.abs((f * 100));
|
||||||
|
|
||||||
|
mLastOverlaySroll = progress;
|
||||||
mLauncherOverlay.onScrollChange(progress, isRtl);
|
mLauncherOverlay.onScrollChange(progress, isRtl);
|
||||||
} else if (shouldOverScroll) {
|
} else if (shouldOverScroll) {
|
||||||
dampedOverScroll(amount);
|
dampedOverScroll(amount);
|
||||||
|
@ -1308,6 +1313,10 @@ public class Workspace extends SmoothPagedView
|
||||||
} else {
|
} else {
|
||||||
mOverScrollEffect = 0;
|
mOverScrollEffect = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shouldZeroOverlay) {
|
||||||
|
mLauncherOverlay.onScrollChange(0, isRtl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue