Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c4ca927 authored by Adam Cohen's avatar Adam Cohen
Browse files

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
parent be25822f
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -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