Flatten nested if-else blocks into plain if-else blocks (refactor step 2.5)
Change-Id: I42aad04658e14e8fd703e3828676719a333ec8f9main
parent
3c6d3a4df8
commit
2a3b15b267
|
@ -971,29 +971,27 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
startRepeatKey(key);
|
startRepeatKey(key);
|
||||||
if (mIsAllowedSlidingKeyInput) {
|
if (mIsAllowedSlidingKeyInput) {
|
||||||
processSlidingKeyInput(key, x, y, eventTime);
|
processSlidingKeyInput(key, x, y, eventTime);
|
||||||
} else {
|
}
|
||||||
// HACK: On some devices, quick successive touches may be reported as a sudden move by
|
// 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
|
// touch panel firmware. This hack detects such cases and translates the move event to
|
||||||
// successive up and down events.
|
// successive up and down events.
|
||||||
// TODO: Should find a way to balance gesture detection and this hack.
|
// TODO: Should find a way to balance gesture detection and this hack.
|
||||||
if (sNeedsPhantomSuddenMoveEventHack
|
else if (sNeedsPhantomSuddenMoveEventHack
|
||||||
&& getDistance(x, y, lastX, lastY) >= mPhantonSuddenMoveThreshold) {
|
&& getDistance(x, y, lastX, lastY) >= mPhantonSuddenMoveThreshold) {
|
||||||
processPhantomSuddenMoveHack(key, x, y, eventTime, oldKey, lastX, lastY);
|
processPhantomSuddenMoveHack(key, x, y, eventTime, oldKey, lastX, lastY);
|
||||||
}
|
}
|
||||||
// HACK: On some devices, quick successive proximate touches may be reported as a bogus
|
// 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
|
// down-move-up event by touch panel firmware. This hack detects such cases and breaks
|
||||||
// these events into separate up and down events.
|
// these events into separate up and down events.
|
||||||
else if (sNeedsProximateBogusDownMoveUpEventHack
|
else if (sNeedsProximateBogusDownMoveUpEventHack && sTimeRecorder.isInFastTyping(eventTime)
|
||||||
&& sTimeRecorder.isInFastTyping(eventTime)
|
|
||||||
&& mBogusMoveEventDetector.isCloseToActualDownEvent(x, y)) {
|
&& mBogusMoveEventDetector.isCloseToActualDownEvent(x, y)) {
|
||||||
processProximateBogusDownMoveUpEventHack(key, x, y, eventTime, oldKey, lastX, lastY);
|
processProximateBogusDownMoveUpEventHack(key, x, y, eventTime, oldKey, lastX, lastY);
|
||||||
}
|
}
|
||||||
else {
|
// HACK: If there are currently multiple touches, register the key even if the finger
|
||||||
// HACK: If there are currently multiple touches, register the key even if the
|
// slides off the key. This defends against noise from some touch panels when there are
|
||||||
// finger slides off the key. This defends against noise from some touch panels
|
// close multiple touches.
|
||||||
// when there are close multiple touches.
|
|
||||||
// Caveat: When in chording input mode with a modifier key, we don't use this hack.
|
// Caveat: When in chording input mode with a modifier key, we don't use this hack.
|
||||||
if (getActivePointerTrackerCount() > 1 && sPointerTrackerQueue != null
|
else if (getActivePointerTrackerCount() > 1 && sPointerTrackerQueue != null
|
||||||
&& !sPointerTrackerQueue.hasModifierKeyOlderThan(this)) {
|
&& !sPointerTrackerQueue.hasModifierKeyOlderThan(this)) {
|
||||||
if (DEBUG_MODE) {
|
if (DEBUG_MODE) {
|
||||||
Log.w(TAG, String.format("[%d] onMoveEvent:"
|
Log.w(TAG, String.format("[%d] onMoveEvent:"
|
||||||
|
@ -1009,8 +1007,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
setReleasedKeyGraphics(oldKey);
|
setReleasedKeyGraphics(oldKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void slideOutFromOldKey(final Key oldKey, final int x, final int y) {
|
private void slideOutFromOldKey(final Key oldKey, final int x, final int y) {
|
||||||
// The pointer has been slid out from the previous key, we must call onRelease() to
|
// The pointer has been slid out from the previous key, we must call onRelease() to
|
||||||
|
|
Loading…
Reference in New Issue