diff options
author | 2012-03-14 18:40:19 +0900 | |
---|---|---|
committer | 2012-03-14 19:01:08 +0900 | |
commit | 2d5c40d8733d0ae0a9280682bba856c67c96344d (patch) | |
tree | 86d850e3abed2ef26051219fccb610c606aa998f /java/src | |
parent | 02e70cf999585d92530fd2fe73c163deed914b2d (diff) | |
download | latinime-2d5c40d8733d0ae0a9280682bba856c67c96344d.tar.gz latinime-2d5c40d8733d0ae0a9280682bba856c67c96344d.tar.xz latinime-2d5c40d8733d0ae0a9280682bba856c67c96344d.zip |
Send key information even when the touch position correction is not triggered.
Bug: 4343280
Change-Id: Id24935f9f0f66ebaa799bb92537d842033427c4c
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/ProximityInfo.java | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java index e2a48306a..61d75e278 100644 --- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java +++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java @@ -124,40 +124,40 @@ public class ProximityInfo { final float[] sweetSpotCenterXs; final float[] sweetSpotCenterYs; final float[] sweetSpotRadii; - final boolean calculateSweetSpotParams; + + for (int i = 0; i < keyCount; ++i) { + final Key key = keys[i]; + keyXCoordinates[i] = key.mX; + keyYCoordinates[i] = key.mY; + keyWidths[i] = key.mWidth; + keyHeights[i] = key.mHeight; + keyCharCodes[i] = key.mCode; + } + if (touchPositionCorrection != null && touchPositionCorrection.isValid()) { sweetSpotCenterXs = new float[keyCount]; sweetSpotCenterYs = new float[keyCount]; sweetSpotRadii = new float[keyCount]; - calculateSweetSpotParams = true; for (int i = 0; i < keyCount; i++) { final Key key = keys[i]; - keyXCoordinates[i] = key.mX; - keyYCoordinates[i] = key.mY; - keyWidths[i] = key.mWidth; - keyHeights[i] = key.mHeight; - keyCharCodes[i] = key.mCode; - if (calculateSweetSpotParams) { - final Rect hitBox = key.mHitBox; - final int row = hitBox.top / mKeyHeight; - if (row < touchPositionCorrection.mRadii.length) { - final float hitBoxCenterX = (hitBox.left + hitBox.right) * 0.5f; - final float hitBoxCenterY = (hitBox.top + hitBox.bottom) * 0.5f; - final float hitBoxWidth = hitBox.right - hitBox.left; - final float hitBoxHeight = hitBox.bottom - hitBox.top; - final float x = touchPositionCorrection.mXs[row]; - final float y = touchPositionCorrection.mYs[row]; - final float radius = touchPositionCorrection.mRadii[row]; - sweetSpotCenterXs[i] = hitBoxCenterX + x * hitBoxWidth; - sweetSpotCenterYs[i] = hitBoxCenterY + y * hitBoxHeight; - sweetSpotRadii[i] = radius * (float) Math.sqrt( - hitBoxWidth * hitBoxWidth + hitBoxHeight * hitBoxHeight); - } + final Rect hitBox = key.mHitBox; + final int row = hitBox.top / mKeyHeight; + if (row < touchPositionCorrection.mRadii.length) { + final float hitBoxCenterX = (hitBox.left + hitBox.right) * 0.5f; + final float hitBoxCenterY = (hitBox.top + hitBox.bottom) * 0.5f; + final float hitBoxWidth = hitBox.right - hitBox.left; + final float hitBoxHeight = hitBox.bottom - hitBox.top; + final float x = touchPositionCorrection.mXs[row]; + final float y = touchPositionCorrection.mYs[row]; + final float radius = touchPositionCorrection.mRadii[row]; + sweetSpotCenterXs[i] = hitBoxCenterX + x * hitBoxWidth; + sweetSpotCenterYs[i] = hitBoxCenterY + y * hitBoxHeight; + sweetSpotRadii[i] = radius * (float) Math.sqrt( + hitBoxWidth * hitBoxWidth + hitBoxHeight * hitBoxHeight); } } } else { sweetSpotCenterXs = sweetSpotCenterYs = sweetSpotRadii = null; - calculateSweetSpotParams = false; } mNativeProximityInfo = setProximityInfoNative(mLocaleStr, MAX_PROXIMITY_CHARS_SIZE, |