mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2025-06-24 03:31:26 +02:00
Handle CANCEL touch events
Handling this event is part of the API but was never done. This caused unstoppable key-repeat. This event isn't common, the only way I found on Android 10 is to switch to the emoji keyboard while holding a key. Some apps might cause this event more often.
This commit is contained in:
parent
fadedfd58f
commit
d53ee811d9
@ -129,6 +129,9 @@ public class Keyboard2View extends View
|
||||
for (p = 0; p < event.getPointerCount(); p++)
|
||||
_pointers.onTouchMove(event.getX(p), event.getY(p), event.getPointerId(p));
|
||||
break;
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
_pointers.onTouchCancel(event.getPointerId(event.getActionIndex()));
|
||||
break;
|
||||
default:
|
||||
return (false);
|
||||
}
|
||||
|
@ -95,6 +95,16 @@ public final class Pointers implements Handler.Callback
|
||||
}
|
||||
}
|
||||
|
||||
public void onTouchCancel(int pointerId)
|
||||
{
|
||||
Pointer ptr = getPtr(pointerId);
|
||||
if (ptr == null)
|
||||
return;
|
||||
stopKeyRepeat(ptr);
|
||||
removePtr(ptr);
|
||||
_handler.onPointerFlagsChanged();
|
||||
}
|
||||
|
||||
public void onTouchDown(float x, float y, int pointerId, KeyboardData.Key key)
|
||||
{
|
||||
KeyValue value = key.key0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user