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

Commit 088d1b95 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix tapping on divider bar several times makes split sloggish" into sc-dev

parents ac126aa9 59f0ef35
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -110,6 +110,10 @@ public class DividerView extends FrameLayout implements View.OnTouchListener,
            return false;
        }

        if (mDoubleTapDetector.onTouchEvent(event)) {
            return true;
        }

        final int action = event.getAction() & MotionEvent.ACTION_MASK;
        final boolean isLandscape = isLandscape();
        // Using raw xy to prevent lost track of motion events while moving divider bar.
@@ -136,21 +140,22 @@ public class DividerView extends FrameLayout implements View.OnTouchListener,
            case MotionEvent.ACTION_UP:
            case MotionEvent.ACTION_CANCEL:
                mVelocityTracker.addMovement(event);
                releaseTouching();

                if (!mMoving) break;

                mVelocityTracker.computeCurrentVelocity(1000 /* units */);
                final float velocity = isLandscape
                        ? mVelocityTracker.getXVelocity()
                        : mVelocityTracker.getYVelocity();
                releaseTouching();
                mMoving = false;

                final int position = mSplitLayout.getDividePosition() + touchPos - mStartPos;
                final DividerSnapAlgorithm.SnapTarget snapTarget =
                        mSplitLayout.findSnapTarget(position, velocity, false /* hardDismiss */);
                mSplitLayout.snapToTarget(position, snapTarget);
                mMoving = false;
                break;
        }

        mDoubleTapDetector.onTouchEvent(event);
        return true;
    }

@@ -229,7 +234,7 @@ public class DividerView extends FrameLayout implements View.OnTouchListener,
            if (mSplitLayout != null) {
                mSplitLayout.onDoubleTappedDivider();
            }
            return false;
            return true;
        }
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -231,6 +231,7 @@ public class SplitLayout {
    }

    private void flingDividePosition(int from, int to) {
        if (from == to) return;
        ValueAnimator animator = ValueAnimator
                .ofInt(from, to)
                .setDuration(250);
+2 −2
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ import android.view.VelocityTracker;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.ViewConfiguration;
import android.view.ViewRootImpl;
import android.view.ViewTreeObserver.InternalInsetsInfo;
import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
import android.view.WindowManager;
@@ -524,9 +523,10 @@ public class DividerView extends FrameLayout implements OnTouchListener,
            case MotionEvent.ACTION_CANCEL:
                mVelocityTracker.addMovement(event);

                if (!mMoving) break;

                x = (int) event.getRawX();
                y = (int) event.getRawY();

                mVelocityTracker.computeCurrentVelocity(1000);
                int position = calculatePosition(x, y);
                stopDragging(position, isHorizontalDivision() ? mVelocityTracker.getYVelocity()