Skip to content

Commit

Permalink
[Fix] Resolve conflict with gesture navigation.
Browse files Browse the repository at this point in the history
Stop immediately starting dragging upon ACTION_DOWN if scrollbar is
visible, because when gesture navigation is enabled, the system may
still temporarily send us an ACTION_DOWN followed by an ACTION_CANCEL.
  • Loading branch information
zhanghai committed Apr 26, 2022
1 parent e483b8c commit 54ac05c
Showing 1 changed file with 2 additions and 7 deletions.
Expand Up @@ -294,14 +294,9 @@ private boolean onTouchEvent(@NonNull MotionEvent event) {
mDownX = eventX;
mDownY = eventY;

if (mTrackView.getAlpha() > 0 && isInView(mTrackView, eventX, eventY)) {
if (mThumbView.getAlpha() > 0 && isInViewTouchTarget(mThumbView, eventX, eventY)) {
mDragStartY = eventY;
if (isInViewTouchTarget(mThumbView, eventX, eventY)) {
mDragStartThumbOffset = mThumbOffset;
} else {
mDragStartThumbOffset = (int) (eventY - padding.top - mThumbHeight / 2f);
scrollToThumbOffset(mDragStartThumbOffset);
}
mDragStartThumbOffset = mThumbOffset;
setDragging(true);
}
break;
Expand Down

0 comments on commit 54ac05c

Please sign in to comment.