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

Commit 711c498f authored by Bobby Georgescu's avatar Bobby Georgescu Committed by Android Git Automerger
Browse files

am 56bc8b74: Merge "Fix snapping behavior in filmstrip" into gb-ub-photos-arches

* commit '56bc8b74':
  Fix snapping behavior in filmstrip
parents 81912a44 56bc8b74
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -941,6 +941,8 @@ public class PhotoView extends GLView {
        private int mDeltaY;
        // The accumulated scaling change from a scaling gesture.
        private float mAccScale;
        // If an onFling happened after the last onDown
        private boolean mHadFling;

        @Override
        public boolean onSingleTapUp(float x, float y) {
@@ -1059,6 +1061,7 @@ public class PhotoView extends GLView {
            } else {
                flingImages(velocityX, velocityY);
            }
            mHadFling = true;
            return true;
        }

@@ -1212,7 +1215,7 @@ public class PhotoView extends GLView {
            } else {
                mDownInScrolling = false;
            }

            mHadFling = false;
            mScrolledAfterDown = false;
            if (mFilmMode) {
                int xi = (int) (x + 0.5f);
@@ -1256,8 +1259,11 @@ public class PhotoView extends GLView {
                mIgnoreUpEvent = false;
                return;
            }

            if (!mFilmMode || mHadFling) {
                snapback();
            } else {
                snapToNeighborImage();
            }
        }

        public void setSwipingEnabled(boolean enabled) {
@@ -1531,14 +1537,12 @@ public class PhotoView extends GLView {

    private void snapback() {
        if ((mHolding & ~HOLD_DELETE) != 0) return;
        if (!snapToNeighborImage()) {
        if (mFilmMode || !snapToNeighborImage()) {
            mPositionController.snapback();
        }
    }

    private boolean snapToNeighborImage() {
        if (mFilmMode) return false;

        Rect r = mPositionController.getPosition(0);
        int viewW = getWidth();
        // Setting the move threshold proportional to the width of the view