diff options
author | 2014-10-03 11:39:21 +0900 | |
---|---|---|
committer | 2014-10-03 18:16:34 +0900 | |
commit | 4ef27c035892888df82d9c9f32ac12ed48c8308f (patch) | |
tree | b23ae4a98571f267c64783c0d5cefca960238981 /java/src | |
parent | fb051c3957ae17061204b06258aec3b2e0f05034 (diff) | |
download | latinime-4ef27c035892888df82d9c9f32ac12ed48c8308f.tar.gz latinime-4ef27c035892888df82d9c9f32ac12ed48c8308f.tar.xz latinime-4ef27c035892888df82d9c9f32ac12ed48c8308f.zip |
[ML13] Fix the locale passing in ProximityInfo
The locale is used to determine additional proximity characters. This
is dependent on the dictionary language, but was passed as a function
of the layout, which is wrong and would have given bad suggestions in
multi-lingual mode.
Ideally, additional proximity characters should be inserted in the
dictionary header, but for now it's a rather simple change to get
it from the dictionary's locale instead of the proximity info locale.
Also, that allows us to remove completely the locale parameter from
proximity info, which is a much needed change.
This change has zero effect on unit tests and on regression tests.
Bug: 11230254
Change-Id: If95157155db7dccd1f00b8ba55ccb3600283f9e4
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/Keyboard.java | 7 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/ProximityInfo.java | 28 |
2 files changed, 13 insertions, 22 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 85dfea4e7..d35c8fae1 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -108,10 +108,9 @@ public class Keyboard { mAltCodeKeysWhileTyping = Collections.unmodifiableList(params.mAltCodeKeysWhileTyping); mIconsSet = params.mIconsSet; - mProximityInfo = new ProximityInfo(params.mId.mLocale.toString(), - params.GRID_WIDTH, params.GRID_HEIGHT, mOccupiedWidth, mOccupiedHeight, - mMostCommonKeyWidth, mMostCommonKeyHeight, mSortedKeys, - params.mTouchPositionCorrection); + mProximityInfo = new ProximityInfo(params.GRID_WIDTH, params.GRID_HEIGHT, + mOccupiedWidth, mOccupiedHeight, mMostCommonKeyWidth, mMostCommonKeyHeight, + mSortedKeys, params.mTouchPositionCorrection); mProximityCharsCorrectionEnabled = params.mProximityCharsCorrectionEnabled; } diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java index c19cd671a..9c5abcd71 100644 --- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java +++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java @@ -52,18 +52,11 @@ public class ProximityInfo { private final int mMostCommonKeyHeight; private final List<Key> mSortedKeys; private final List<Key>[] mGridNeighbors; - private final String mLocaleStr; @SuppressWarnings("unchecked") - ProximityInfo(final String localeStr, final int gridWidth, final int gridHeight, - final int minWidth, final int height, final int mostCommonKeyWidth, - final int mostCommonKeyHeight, final List<Key> sortedKeys, + ProximityInfo(final int gridWidth, final int gridHeight, final int minWidth, final int height, + final int mostCommonKeyWidth, final int mostCommonKeyHeight, final List<Key> sortedKeys, final TouchPositionCorrection touchPositionCorrection) { - if (TextUtils.isEmpty(localeStr)) { - mLocaleStr = ""; - } else { - mLocaleStr = localeStr; - } mGridWidth = gridWidth; mGridHeight = gridHeight; mGridSize = mGridWidth * mGridHeight; @@ -89,11 +82,10 @@ public class ProximityInfo { } // TODO: Stop passing proximityCharsArray - private static native long setProximityInfoNative(String locale, - int displayWidth, int displayHeight, int gridWidth, int gridHeight, - int mostCommonKeyWidth, int mostCommonKeyHeight, int[] proximityCharsArray, - int keyCount, int[] keyXCoordinates, int[] keyYCoordinates, int[] keyWidths, - int[] keyHeights, int[] keyCharCodes, float[] sweetSpotCenterXs, + private static native long setProximityInfoNative(int displayWidth, int displayHeight, + int gridWidth, int gridHeight, int mostCommonKeyWidth, int mostCommonKeyHeight, + int[] proximityCharsArray, int keyCount, int[] keyXCoordinates, int[] keyYCoordinates, + int[] keyWidths, int[] keyHeights, int[] keyCharCodes, float[] sweetSpotCenterXs, float[] sweetSpotCenterYs, float[] sweetSpotRadii); private static native void releaseProximityInfoNative(long nativeProximityInfo); @@ -221,10 +213,10 @@ public class ProximityInfo { } // TODO: Stop passing proximityCharsArray - return setProximityInfoNative(mLocaleStr, mKeyboardMinWidth, mKeyboardHeight, - mGridWidth, mGridHeight, mMostCommonKeyWidth, mMostCommonKeyHeight, - proximityCharsArray, keyCount, keyXCoordinates, keyYCoordinates, keyWidths, - keyHeights, keyCharCodes, sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii); + return setProximityInfoNative(mKeyboardMinWidth, mKeyboardHeight, mGridWidth, mGridHeight, + mMostCommonKeyWidth, mMostCommonKeyHeight, proximityCharsArray, keyCount, + keyXCoordinates, keyYCoordinates, keyWidths, keyHeights, keyCharCodes, + sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii); } public long getNativeProximityInfo() { |