diff options
author | 2012-10-31 03:46:04 -0700 | |
---|---|---|
committer | 2012-10-31 03:46:05 -0700 | |
commit | 661bc810e59f74a76d397728e8cd82d24a7551d1 (patch) | |
tree | db4dcd68472d69b16b4793fea3c4c54b4bef89e7 /java/src | |
parent | 8ae9fbef77a75cad30f5da325cde179557327c1e (diff) | |
parent | 2a3b15b267f4a4c43a2d3f47241c489b9cd94d41 (diff) | |
download | latinime-661bc810e59f74a76d397728e8cd82d24a7551d1.tar.gz latinime-661bc810e59f74a76d397728e8cd82d24a7551d1.tar.xz latinime-661bc810e59f74a76d397728e8cd82d24a7551d1.zip |
Merge "Flatten nested if-else blocks into plain if-else blocks (refactor step 2.5)"
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/PointerTracker.java | 68 |
1 files changed, 32 insertions, 36 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index 110393b9c..fc31c9436 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -971,44 +971,40 @@ public final class PointerTracker implements PointerTrackerQueue.Element { startRepeatKey(key); if (mIsAllowedSlidingKeyInput) { processSlidingKeyInput(key, x, y, eventTime); - } else { - // HACK: On some devices, quick successive touches may be reported as a sudden move by - // touch panel firmware. This hack detects such cases and translates the move event to - // successive up and down events. - // TODO: Should find a way to balance gesture detection and this hack. - if (sNeedsPhantomSuddenMoveEventHack - && getDistance(x, y, lastX, lastY) >= mPhantonSuddenMoveThreshold) { - processPhantomSuddenMoveHack(key, x, y, eventTime, oldKey, lastX, lastY); - } - // HACK: On some devices, quick successive proximate touches may be reported as a bogus - // down-move-up event by touch panel firmware. This hack detects such cases and breaks - // these events into separate up and down events. - else if (sNeedsProximateBogusDownMoveUpEventHack - && sTimeRecorder.isInFastTyping(eventTime) - && mBogusMoveEventDetector.isCloseToActualDownEvent(x, y)) { - processProximateBogusDownMoveUpEventHack(key, x, y, eventTime, oldKey, lastX, lastY); + } + // HACK: On some devices, quick successive touches may be reported as a sudden move by + // touch panel firmware. This hack detects such cases and translates the move event to + // successive up and down events. + // TODO: Should find a way to balance gesture detection and this hack. + else if (sNeedsPhantomSuddenMoveEventHack + && getDistance(x, y, lastX, lastY) >= mPhantonSuddenMoveThreshold) { + processPhantomSuddenMoveHack(key, x, y, eventTime, oldKey, lastX, lastY); + } + // HACK: On some devices, quick successive proximate touches may be reported as a bogus + // down-move-up event by touch panel firmware. This hack detects such cases and breaks + // these events into separate up and down events. + else if (sNeedsProximateBogusDownMoveUpEventHack && sTimeRecorder.isInFastTyping(eventTime) + && mBogusMoveEventDetector.isCloseToActualDownEvent(x, y)) { + processProximateBogusDownMoveUpEventHack(key, x, y, eventTime, oldKey, lastX, lastY); + } + // HACK: If there are currently multiple touches, register the key even if the finger + // slides off the key. This defends against noise from some touch panels when there are + // close multiple touches. + // Caveat: When in chording input mode with a modifier key, we don't use this hack. + else if (getActivePointerTrackerCount() > 1 && sPointerTrackerQueue != null + && !sPointerTrackerQueue.hasModifierKeyOlderThan(this)) { + if (DEBUG_MODE) { + Log.w(TAG, String.format("[%d] onMoveEvent:" + + " detected sliding finger while multi touching", mPointerId)); } - else { - // HACK: If there are currently multiple touches, register the key even if the - // finger slides off the key. This defends against noise from some touch panels - // when there are close multiple touches. - // Caveat: When in chording input mode with a modifier key, we don't use this hack. - if (getActivePointerTrackerCount() > 1 && sPointerTrackerQueue != null - && !sPointerTrackerQueue.hasModifierKeyOlderThan(this)) { - if (DEBUG_MODE) { - Log.w(TAG, String.format("[%d] onMoveEvent:" - + " detected sliding finger while multi touching", mPointerId)); - } - onUpEvent(x, y, eventTime); - mKeyAlreadyProcessed = true; - setReleasedKeyGraphics(oldKey); - } else { - if (!mIsDetectingGesture) { - mKeyAlreadyProcessed = true; - } - setReleasedKeyGraphics(oldKey); - } + onUpEvent(x, y, eventTime); + mKeyAlreadyProcessed = true; + setReleasedKeyGraphics(oldKey); + } else { + if (!mIsDetectingGesture) { + mKeyAlreadyProcessed = true; } + setReleasedKeyGraphics(oldKey); } } |