Straighten an if-else-if blocks into if-return blocks

Change-Id: If3eede1257658f27384e3efc72586fabbed19f7b
This commit is contained in:
Tadashi G. Takaoka 2012-10-31 18:57:10 +09:00
parent 01f6a61e51
commit a232930d9c

View File

@ -1165,7 +1165,11 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
final Key curKey = mCurrentKey; final Key curKey = mCurrentKey;
if (newKey == curKey) { if (newKey == curKey) {
return false; return false;
} else if (curKey != null) { }
if (curKey == null /* && newKey != null */) {
return true;
}
// Here curKey points to the different key from newKey.
final int keyHysteresisDistanceSquared = mKeyDetector.getKeyHysteresisDistanceSquared( final int keyHysteresisDistanceSquared = mKeyDetector.getKeyHysteresisDistanceSquared(
mIsInSlidingKeyInputFromModifier); mIsInSlidingKeyInputFromModifier);
final int distanceFromKeyEdgeSquared = curKey.squaredDistanceToEdge(x, y); final int distanceFromKeyEdgeSquared = curKey.squaredDistanceToEdge(x, y);
@ -1174,8 +1178,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
final float distanceToEdgeRatio = (float)Math.sqrt(distanceFromKeyEdgeSquared) final float distanceToEdgeRatio = (float)Math.sqrt(distanceFromKeyEdgeSquared)
/ mKeyboard.mMostCommonKeyWidth; / mKeyboard.mMostCommonKeyWidth;
Log.d(TAG, String.format("[%d] isMajorEnoughMoveToBeOnNewKey:" Log.d(TAG, String.format("[%d] isMajorEnoughMoveToBeOnNewKey:"
+" %.2f key width from key edge", +" %.2f key width from key edge", mPointerId, distanceToEdgeRatio));
mPointerId, distanceToEdgeRatio));
} }
return true; return true;
} }
@ -1194,9 +1197,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
return true; return true;
} }
return false; return false;
} else { // curKey == null && newKey != null
return true;
}
} }
private void startLongPressTimer(final Key key) { private void startLongPressTimer(final Key key) {