Send key information even when the touch position correction is not triggered.

Bug: 4343280
Change-Id: Id24935f9f0f66ebaa799bb92537d842033427c4c
This commit is contained in:
satok 2012-03-14 18:40:19 +09:00
parent 02e70cf999
commit 2d5c40d873

View file

@ -124,40 +124,40 @@ public class ProximityInfo {
final float[] sweetSpotCenterXs; final float[] sweetSpotCenterXs;
final float[] sweetSpotCenterYs; final float[] sweetSpotCenterYs;
final float[] sweetSpotRadii; 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()) { if (touchPositionCorrection != null && touchPositionCorrection.isValid()) {
sweetSpotCenterXs = new float[keyCount]; sweetSpotCenterXs = new float[keyCount];
sweetSpotCenterYs = new float[keyCount]; sweetSpotCenterYs = new float[keyCount];
sweetSpotRadii = new float[keyCount]; sweetSpotRadii = new float[keyCount];
calculateSweetSpotParams = true;
for (int i = 0; i < keyCount; i++) { for (int i = 0; i < keyCount; i++) {
final Key key = keys[i]; final Key key = keys[i];
keyXCoordinates[i] = key.mX; final Rect hitBox = key.mHitBox;
keyYCoordinates[i] = key.mY; final int row = hitBox.top / mKeyHeight;
keyWidths[i] = key.mWidth; if (row < touchPositionCorrection.mRadii.length) {
keyHeights[i] = key.mHeight; final float hitBoxCenterX = (hitBox.left + hitBox.right) * 0.5f;
keyCharCodes[i] = key.mCode; final float hitBoxCenterY = (hitBox.top + hitBox.bottom) * 0.5f;
if (calculateSweetSpotParams) { final float hitBoxWidth = hitBox.right - hitBox.left;
final Rect hitBox = key.mHitBox; final float hitBoxHeight = hitBox.bottom - hitBox.top;
final int row = hitBox.top / mKeyHeight; final float x = touchPositionCorrection.mXs[row];
if (row < touchPositionCorrection.mRadii.length) { final float y = touchPositionCorrection.mYs[row];
final float hitBoxCenterX = (hitBox.left + hitBox.right) * 0.5f; final float radius = touchPositionCorrection.mRadii[row];
final float hitBoxCenterY = (hitBox.top + hitBox.bottom) * 0.5f; sweetSpotCenterXs[i] = hitBoxCenterX + x * hitBoxWidth;
final float hitBoxWidth = hitBox.right - hitBox.left; sweetSpotCenterYs[i] = hitBoxCenterY + y * hitBoxHeight;
final float hitBoxHeight = hitBox.bottom - hitBox.top; sweetSpotRadii[i] = radius * (float) Math.sqrt(
final float x = touchPositionCorrection.mXs[row]; hitBoxWidth * hitBoxWidth + hitBoxHeight * hitBoxHeight);
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 { } else {
sweetSpotCenterXs = sweetSpotCenterYs = sweetSpotRadii = null; sweetSpotCenterXs = sweetSpotCenterYs = sweetSpotRadii = null;
calculateSweetSpotParams = false;
} }
mNativeProximityInfo = setProximityInfoNative(mLocaleStr, MAX_PROXIMITY_CHARS_SIZE, mNativeProximityInfo = setProximityInfoNative(mLocaleStr, MAX_PROXIMITY_CHARS_SIZE,