forked from extern/Unexpected-Keyboard
Correctly handle pointer cancel events
The cancel event ends the motion, it doesn't apply to a single pointer like it was previously expected.
This commit is contained in:
parent
aaf3d8b630
commit
804ea84981
@ -172,7 +172,7 @@ public class Keyboard2View extends View
|
||||
_pointers.onTouchMove(event.getX(p), event.getY(p), event.getPointerId(p));
|
||||
break;
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
_pointers.onTouchCancel(event.getPointerId(event.getActionIndex()));
|
||||
_pointers.onTouchCancel();
|
||||
break;
|
||||
default:
|
||||
return (false);
|
||||
|
@ -48,6 +48,8 @@ public final class Pointers implements Handler.Callback
|
||||
|
||||
public void clear()
|
||||
{
|
||||
for (Pointer p : _ptrs)
|
||||
stopKeyRepeat(p);
|
||||
_ptrs.clear();
|
||||
}
|
||||
|
||||
@ -128,13 +130,9 @@ public final class Pointers implements Handler.Callback
|
||||
}
|
||||
}
|
||||
|
||||
public void onTouchCancel(int pointerId)
|
||||
public void onTouchCancel()
|
||||
{
|
||||
Pointer ptr = getPtr(pointerId);
|
||||
if (ptr == null)
|
||||
return;
|
||||
stopKeyRepeat(ptr);
|
||||
removePtr(ptr);
|
||||
clear();
|
||||
_handler.onPointerFlagsChanged(true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user