Prevent double touch inputs in the BaseDragLayer

If you hold a long press and while pressing you start another
long press again with another finger, then a new onLongPress event
will trigger and in some cases we are not processing that case.

By ignoring the evetns with the flag ACTION_OUTSIDE we can prevent
such cases.

Fix: 247477725
Test: ReorderWidgets
Change-Id: I31833bc54db2771809562bd1f92c8523eb2f05ab
This commit is contained in:
Sebastian Franco
2022-09-23 17:50:07 -05:00
parent 1874371aab
commit 68fc44ffad

View File

@@ -273,6 +273,12 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (ev.getActionIndex() > 0) {
// This means there is multiple touch inputs, ignore it, we could also cancel the
// previous touch but the user might cancel the drag by accident.
return true;
}
switch (ev.getAction()) {
case ACTION_DOWN: {
if ((mTouchDispatchState & TOUCH_DISPATCHING_TO_VIEW_IN_PROGRESS) != 0) {