From 8c4ca9277dcb92cb965a1e58eef59ad9868ae44e Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Fri, 24 Oct 2014 17:40:34 -0700 Subject: [PATCH] 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 518ee97b49..66d4ac010b 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -295,6 +295,7 @@ public class Workspace extends SmoothPagedView boolean mScrollInteractionBegan; boolean mStartedSendingScrollEvents; boolean mShouldSendPageSettled; + int mLastOverlaySroll = 0; private final Runnable mBindPages = new Runnable() { @Override @@ -1287,8 +1288,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) { @@ -1301,6 +1305,7 @@ public class Workspace extends SmoothPagedView int progress = (int) Math.abs((f * 100)); + mLastOverlaySroll = progress; mLauncherOverlay.onScrollChange(progress, isRtl); } else if (shouldOverScroll) { dampedOverScroll(amount); @@ -1308,6 +1313,10 @@ public class Workspace extends SmoothPagedView } else { mOverScrollEffect = 0; } + + if (shouldZeroOverlay) { + mLauncherOverlay.onScrollChange(0, isRtl); + } } @Override