mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Ignore other finger while showing more keys keyboard
Bug: 12088861 Change-Id: I784cb8fee247a7a4ea4af4c0569fed9334430e18
This commit is contained in:
parent
fa860a091e
commit
7f82bb55ed
@ -1008,6 +1008,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||
final int index = me.getActionIndex();
|
||||
final int id = me.getPointerId(index);
|
||||
final PointerTracker tracker = PointerTracker.getPointerTracker(id);
|
||||
// When a more keys panel is showing, we should ignore other fingers' single touch events
|
||||
// other than the finger that is showing the more keys panel.
|
||||
if (isShowingMoreKeysPanel() && !tracker.isShowingMoreKeysPanel()
|
||||
&& PointerTracker.getActivePointerTrackerCount() == 1) {
|
||||
return true;
|
||||
}
|
||||
tracker.processMotionEvent(me, mKeyDetector);
|
||||
return true;
|
||||
}
|
||||
|
@ -715,7 +715,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||
return newKey;
|
||||
}
|
||||
|
||||
private static int getActivePointerTrackerCount() {
|
||||
/* package */ static int getActivePointerTrackerCount() {
|
||||
return sPointerTrackerQueue.size();
|
||||
}
|
||||
|
||||
@ -827,12 +827,19 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||
final int action = me.getActionMasked();
|
||||
final long eventTime = me.getEventTime();
|
||||
if (action == MotionEvent.ACTION_MOVE) {
|
||||
// When this pointer is the only active pointer and is showing a more keys panel,
|
||||
// we should ignore other pointers' motion event.
|
||||
final boolean shouldIgnoreOtherPointers =
|
||||
isShowingMoreKeysPanel() && getActivePointerTrackerCount() == 1;
|
||||
final int pointerCount = me.getPointerCount();
|
||||
for (int index = 0; index < pointerCount; index++) {
|
||||
final int id = me.getPointerId(index);
|
||||
final PointerTracker tracker = getPointerTracker(id);
|
||||
if (shouldIgnoreOtherPointers && id != mPointerId) {
|
||||
continue;
|
||||
}
|
||||
final int x = (int)me.getX(index);
|
||||
final int y = (int)me.getY(index);
|
||||
final PointerTracker tracker = getPointerTracker(id);
|
||||
tracker.onMoveEvent(x, y, eventTime, me);
|
||||
}
|
||||
return;
|
||||
@ -903,7 +910,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isShowingMoreKeysPanel() {
|
||||
/* package */ boolean isShowingMoreKeysPanel() {
|
||||
return (mMoreKeysPanel != null);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user