Merge "Fix not releasing touching state of the handle on divider bar" into sc-dev am: 6c2ffa9595

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14540393

Change-Id: If57753c912ecf57bed2dea095be6b7fc03e0fdd5
This commit is contained in:
Jerry Chang
2021-05-19 00:16:20 +00:00
committed by Automerger Merge Worker
2 changed files with 6 additions and 5 deletions

View File

@@ -131,11 +131,10 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
mVelocityTracker.addMovement(event);
releaseTouching();
if (!mMoving) break;
mVelocityTracker.addMovement(event);
mVelocityTracker.computeCurrentVelocity(1000 /* units */);
final float velocity = isLandscape
? mVelocityTracker.getXVelocity()

View File

@@ -521,12 +521,14 @@ public class DividerView extends FrameLayout implements OnTouchListener,
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
mVelocityTracker.addMovement(event);
if (!mMoving) break;
if (!mMoving) {
stopDragging();
break;
}
x = (int) event.getRawX();
y = (int) event.getRawY();
mVelocityTracker.addMovement(event);
mVelocityTracker.computeCurrentVelocity(1000);
int position = calculatePosition(x, y);
stopDragging(position, isHorizontalDivision() ? mVelocityTracker.getYVelocity()