Merge "Fix gesture detection when sliding key input is disabled"
commit
e863fb712f
|
@ -794,13 +794,16 @@ public class PointerTracker {
|
||||||
final int dx = x - lastX;
|
final int dx = x - lastX;
|
||||||
final int dy = y - lastY;
|
final int dy = y - lastY;
|
||||||
final int lastMoveSquared = dx * dx + dy * dy;
|
final int lastMoveSquared = dx * dx + dy * dy;
|
||||||
|
// TODO: Should find a way to balance gesture detection and this hack.
|
||||||
if (sNeedsPhantomSuddenMoveEventHack
|
if (sNeedsPhantomSuddenMoveEventHack
|
||||||
&& lastMoveSquared >= mKeyQuarterWidthSquared) {
|
&& lastMoveSquared >= mKeyQuarterWidthSquared
|
||||||
|
&& !mIsPossibleGesture) {
|
||||||
if (DEBUG_MODE) {
|
if (DEBUG_MODE) {
|
||||||
Log.w(TAG, String.format("onMoveEvent:"
|
Log.w(TAG, String.format("onMoveEvent:"
|
||||||
+ " phantom sudden move event is translated to "
|
+ " phantom sudden move event is translated to "
|
||||||
+ "up[%d,%d]/down[%d,%d] events", lastX, lastY, x, y));
|
+ "up[%d,%d]/down[%d,%d] events", lastX, lastY, x, y));
|
||||||
}
|
}
|
||||||
|
// TODO: This should be moved to outside of this nested if-clause?
|
||||||
if (ProductionFlag.IS_EXPERIMENTAL) {
|
if (ProductionFlag.IS_EXPERIMENTAL) {
|
||||||
ResearchLogger.pointerTracker_onMoveEvent(x, y, lastX, lastY);
|
ResearchLogger.pointerTracker_onMoveEvent(x, y, lastX, lastY);
|
||||||
}
|
}
|
||||||
|
@ -816,7 +819,9 @@ public class PointerTracker {
|
||||||
&& !sPointerTrackerQueue.hasModifierKeyOlderThan(this)) {
|
&& !sPointerTrackerQueue.hasModifierKeyOlderThan(this)) {
|
||||||
onUpEventInternal(x, y, eventTime);
|
onUpEventInternal(x, y, eventTime);
|
||||||
}
|
}
|
||||||
|
if (!mIsPossibleGesture) {
|
||||||
mKeyAlreadyProcessed = true;
|
mKeyAlreadyProcessed = true;
|
||||||
|
}
|
||||||
setReleasedKeyGraphics(oldKey);
|
setReleasedKeyGraphics(oldKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -832,11 +837,13 @@ public class PointerTracker {
|
||||||
if (mIsAllowedSlidingKeyInput) {
|
if (mIsAllowedSlidingKeyInput) {
|
||||||
onMoveToNewKey(key, x, y);
|
onMoveToNewKey(key, x, y);
|
||||||
} else {
|
} else {
|
||||||
|
if (!mIsPossibleGesture) {
|
||||||
mKeyAlreadyProcessed = true;
|
mKeyAlreadyProcessed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onUpEvent(int x, int y, long eventTime) {
|
public void onUpEvent(int x, int y, long eventTime) {
|
||||||
if (DEBUG_EVENT)
|
if (DEBUG_EVENT)
|
||||||
|
@ -871,6 +878,7 @@ public class PointerTracker {
|
||||||
private void onUpEventInternal(int x, int y, long eventTime) {
|
private void onUpEventInternal(int x, int y, long eventTime) {
|
||||||
mTimerProxy.cancelKeyTimers();
|
mTimerProxy.cancelKeyTimers();
|
||||||
mIsInSlidingKeyInput = false;
|
mIsInSlidingKeyInput = false;
|
||||||
|
mIsPossibleGesture = false;
|
||||||
// Release the last pressed key.
|
// Release the last pressed key.
|
||||||
setReleasedKeyGraphics(mCurrentKey);
|
setReleasedKeyGraphics(mCurrentKey);
|
||||||
if (mIsShowingMoreKeysPanel) {
|
if (mIsShowingMoreKeysPanel) {
|
||||||
|
|
Loading…
Reference in New Issue