Pass the locale to the native code

Change-Id: I8f73b9b33cca56b3fa44ec6259c0896be22f4a47
main
satok 2012-03-13 19:16:33 +09:00
parent 5eec574cf0
commit 7ef1dabd92
2 changed files with 12 additions and 4 deletions

View File

@ -154,7 +154,7 @@ public class Keyboard {
mIconsSet = params.mIconsSet;
mAdditionalProximityChars = params.mAdditionalProximityChars;
mProximityInfo = new ProximityInfo(
mProximityInfo = new ProximityInfo(params.mId.mLocale.toString(),
params.GRID_WIDTH, params.GRID_HEIGHT, mOccupiedWidth, mOccupiedHeight,
mMostCommonKeyWidth, mMostCommonKeyHeight, mKeys, params.mTouchPositionCorrection,
params.mAdditionalProximityChars);

View File

@ -17,6 +17,7 @@
package com.android.inputmethod.keyboard;
import android.graphics.Rect;
import android.text.TextUtils;
import com.android.inputmethod.keyboard.Keyboard.Params.TouchPositionCorrection;
import com.android.inputmethod.latin.JniUtils;
@ -46,10 +47,17 @@ public class ProximityInfo {
private final int mKeyboardHeight;
private final int mMostCommonKeyWidth;
private final Key[][] mGridNeighbors;
private final String mLocaleStr;
ProximityInfo(int gridWidth, int gridHeight, int minWidth, int height, int mostCommonKeyWidth,
ProximityInfo(String localeStr, int gridWidth, int gridHeight, int minWidth, int height,
int mostCommonKeyWidth,
int mostCommonKeyHeight, Set<Key> keys, TouchPositionCorrection touchPositionCorrection,
Map<Integer, List<Integer>> additionalProximityChars) {
if (TextUtils.isEmpty(localeStr)) {
mLocaleStr = "";
} else {
mLocaleStr = localeStr;
}
mGridWidth = gridWidth;
mGridHeight = gridHeight;
mGridSize = mGridWidth * mGridHeight;
@ -69,7 +77,7 @@ public class ProximityInfo {
}
public static ProximityInfo createDummyProximityInfo() {
return new ProximityInfo(1, 1, 1, 1, 1, 1, Collections.<Key> emptySet(),
return new ProximityInfo("", 1, 1, 1, 1, 1, 1, Collections.<Key> emptySet(),
null, Collections.<Integer, List<Integer>> emptyMap());
}
@ -155,7 +163,7 @@ public class ProximityInfo {
calculateSweetSpotParams = false;
}
mNativeProximityInfo = setProximityInfoNative("", MAX_PROXIMITY_CHARS_SIZE,
mNativeProximityInfo = setProximityInfoNative(mLocaleStr, MAX_PROXIMITY_CHARS_SIZE,
keyboardWidth, keyboardHeight, mGridWidth, mGridHeight, mMostCommonKeyWidth,
proximityCharsArray,
keyCount, keyXCoordinates, keyYCoordinates, keyWidths, keyHeights, keyCharCodes,