diff options
author | 2012-10-03 20:49:57 +0900 | |
---|---|---|
committer | 2012-10-09 19:20:28 +0900 | |
commit | f9aa99c1c94908c47aed17ba47795668d68d4088 (patch) | |
tree | cf102474cca2a15d8ac2ab9ab5feeb0dce9187bb /java/src | |
parent | 60f6120e2bbe9f6b6f53f7dfcd8421cda2cedc4c (diff) | |
download | latinime-f9aa99c1c94908c47aed17ba47795668d68d4088.tar.gz latinime-f9aa99c1c94908c47aed17ba47795668d68d4088.tar.xz latinime-f9aa99c1c94908c47aed17ba47795668d68d4088.zip |
Disable touch position correction of MoreKeysKeyboard
Change-Id: Ieec33894a348602fd71d6fe473142b43eb2551b6
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/ProximityInfo.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java index 06a9e9252..94fc80507 100644 --- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java +++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java @@ -18,6 +18,7 @@ package com.android.inputmethod.keyboard; import android.graphics.Rect; import android.text.TextUtils; +import android.util.Log; import com.android.inputmethod.keyboard.internal.TouchPositionCorrection; import com.android.inputmethod.latin.Constants; @@ -26,11 +27,14 @@ import com.android.inputmethod.latin.JniUtils; import java.util.Arrays; public final class ProximityInfo { + private static final String TAG = ProximityInfo.class.getSimpleName(); + private static final boolean DEBUG = false; + /** MAX_PROXIMITY_CHARS_SIZE must be the same as MAX_PROXIMITY_CHARS_SIZE_INTERNAL * in defines.h */ public static final int MAX_PROXIMITY_CHARS_SIZE = 16; /** Number of key widths from current touch point to search for nearest keys. */ - private static float SEARCH_DISTANCE = 1.2f; + private static final float SEARCH_DISTANCE = 1.2f; private static final Key[] EMPTY_KEY_ARRAY = new Key[0]; private static final float DEFAULT_TOUCH_POSITION_CORRECTION_RADIUS = 0.15f; @@ -140,9 +144,13 @@ public final class ProximityInfo { } if (touchPositionCorrection != null && touchPositionCorrection.isValid()) { + if (DEBUG) { + Log.d(TAG, "touchPositionCorrection: ON"); + } sweetSpotCenterXs = new float[keyCount]; sweetSpotCenterYs = new float[keyCount]; sweetSpotRadii = new float[keyCount]; + final int rows = touchPositionCorrection.getRows(); final float defaultRadius = DEFAULT_TOUCH_POSITION_CORRECTION_RADIUS * (float)Math.hypot(mMostCommonKeyWidth, mMostCommonKeyHeight); for (int i = 0; i < keyCount; i++) { @@ -152,7 +160,7 @@ public final class ProximityInfo { sweetSpotCenterYs[i] = hitBox.exactCenterY(); sweetSpotRadii[i] = defaultRadius; final int row = hitBox.top / mMostCommonKeyHeight; - if (row < touchPositionCorrection.getRows()) { + if (row < rows) { final int hitBoxWidth = hitBox.width(); final int hitBoxHeight = hitBox.height(); final float hitBoxDiagonal = (float)Math.hypot(hitBoxWidth, hitBoxHeight); @@ -160,9 +168,18 @@ public final class ProximityInfo { sweetSpotCenterYs[i] += touchPositionCorrection.getY(row) * hitBoxHeight; sweetSpotRadii[i] = touchPositionCorrection.getRadius(row) * hitBoxDiagonal; } + if (DEBUG) { + Log.d(TAG, String.format( + " [%2d] row=%d x/y/r=%7.2f/%7.2f/%5.2f %s code=%s", i, row, + sweetSpotCenterXs[i], sweetSpotCenterYs[i], sweetSpotRadii[i], + row < rows ? "correct" : "default", Keyboard.printableCode(key.mCode))); + } } } else { sweetSpotCenterXs = sweetSpotCenterYs = sweetSpotRadii = null; + if (DEBUG) { + Log.d(TAG, "touchPositionCorrection: OFF"); + } } return setProximityInfoNative(mLocaleStr, MAX_PROXIMITY_CHARS_SIZE, |