Merge "Ignore other finger while showing more keys keyboard"
commit
0719c4ca72
|
@ -1008,6 +1008,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
final int index = me.getActionIndex();
|
final int index = me.getActionIndex();
|
||||||
final int id = me.getPointerId(index);
|
final int id = me.getPointerId(index);
|
||||||
final PointerTracker tracker = PointerTracker.getPointerTracker(id);
|
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);
|
tracker.processMotionEvent(me, mKeyDetector);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -715,7 +715,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
return newKey;
|
return newKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getActivePointerTrackerCount() {
|
/* package */ static int getActivePointerTrackerCount() {
|
||||||
return sPointerTrackerQueue.size();
|
return sPointerTrackerQueue.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,12 +827,19 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
final int action = me.getActionMasked();
|
final int action = me.getActionMasked();
|
||||||
final long eventTime = me.getEventTime();
|
final long eventTime = me.getEventTime();
|
||||||
if (action == MotionEvent.ACTION_MOVE) {
|
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();
|
final int pointerCount = me.getPointerCount();
|
||||||
for (int index = 0; index < pointerCount; index++) {
|
for (int index = 0; index < pointerCount; index++) {
|
||||||
final int id = me.getPointerId(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 x = (int)me.getX(index);
|
||||||
final int y = (int)me.getY(index);
|
final int y = (int)me.getY(index);
|
||||||
|
final PointerTracker tracker = getPointerTracker(id);
|
||||||
tracker.onMoveEvent(x, y, eventTime, me);
|
tracker.onMoveEvent(x, y, eventTime, me);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -903,7 +910,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isShowingMoreKeysPanel() {
|
/* package */ boolean isShowingMoreKeysPanel() {
|
||||||
return (mMoreKeysPanel != null);
|
return (mMoreKeysPanel != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue