From 42bdeeea7fd06c71f6aa1b179ada3c8c7b1559ba Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Fri, 24 Oct 2014 17:40:34 -0700 Subject: 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 --- src/com/android/launcher3/Workspace.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 2cbbaa702..aa919b307 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -301,6 +301,7 @@ public class Workspace extends SmoothPagedView boolean mScrollInteractionBegan; boolean mStartedSendingScrollEvents; boolean mShouldSendPageSettled; + int mLastOverlaySroll = 0; private final Runnable mBindPages = new Runnable() { @Override @@ -1322,8 +1323,11 @@ public class Workspace extends SmoothPagedView boolean shouldOverScroll = (amount <= 0 && (!hasCustomContent() || isRtl)) || (amount >= 0 && (!hasCustomContent() || !isRtl)); - boolean shouldScrollOverlay = (amount <= 0 && mLauncherOverlay != null && !isRtl) || - (amount >= 0 && mLauncherOverlay != null && isRtl); + boolean shouldScrollOverlay = mLauncherOverlay != null && + ((amount <= 0 && !isRtl) || (amount >= 0 && isRtl)); + + boolean shouldZeroOverlay = mLauncherOverlay != null && mLastOverlaySroll != 0 && + ((amount >= 0 && !isRtl) || (amount <= 0 && isRtl)); if (shouldScrollOverlay) { if (!mStartedSendingScrollEvents && mScrollInteractionBegan) { @@ -1336,6 +1340,7 @@ public class Workspace extends SmoothPagedView int progress = (int) Math.abs((f * 100)); + mLastOverlaySroll = progress; mLauncherOverlay.onScrollChange(progress, isRtl); } else if (shouldOverScroll) { dampedOverScroll(amount); @@ -1343,6 +1348,10 @@ public class Workspace extends SmoothPagedView } else { mOverScrollEffect = 0; } + + if (shouldZeroOverlay) { + mLauncherOverlay.onScrollChange(0, isRtl); + } } @Override -- cgit v1.2.3