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

Commit 38f92cf9 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Fixing scrollTo getting called even though the gesture was handled by an overlay

Change-Id: Ia46c4ef3db8a3ae4fa615625b7b983d7e461c797
(cherry picked from commit 061380a0)
parent d6e208b0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc

    protected boolean mIsPageMoving = false;

    private boolean mWasInOverscroll = false;
    protected boolean mWasInOverscroll = false;

    // Page Indicator
    @Thunk int mPageIndicatorViewId;
+25 −5
Original line number Diff line number Diff line
@@ -1261,16 +1261,36 @@ public class Workspace extends PagedView

    @Override
    protected int getUnboundedScrollX() {
        if (mLauncherOverlay != null) {
            if ((mIsRtl && mUnboundedScrollX > mMaxScrollX) ||
                    (!mIsRtl && mUnboundedScrollX < 0)) {
        if (isScrollingOverlay()) {
            return mUnboundedScrollX;
        }
        }

        return super.getUnboundedScrollX();
    }

    private boolean isScrollingOverlay() {
        return mLauncherOverlay != null &&
                ((mIsRtl && mUnboundedScrollX > mMaxScrollX) || (!mIsRtl && mUnboundedScrollX < 0));
    }

    @Override
    protected void snapToDestination() {
        // If we're overscrolling the overlay, we make sure to immediately reset the PagedView
        // to it's baseline position instead of letting the overscroll settle. The overlay handles
        // it's own settling, and every gesture to the overlay should be self-contained and start
        // from 0, so we zero it out here.
        if (isScrollingOverlay()) {
            int finalScroll = mIsRtl ? mMaxScrollX : 0;

            // We reset mWasInOverscroll so that PagedView doesn't zero out the overscroll
            // interaction when we call scrollTo.
            mWasInOverscroll = false;
            scrollTo(finalScroll, getScrollY());
        } else {
            super.snapToDestination();
        }
    }

    @Override
    public void scrollTo(int x, int y) {
        mUnboundedScrollX = x;