From 7ef1dabd92a9dae042965cd10d08a2cd47455dcc Mon Sep 17 00:00:00 2001 From: satok Date: Tue, 13 Mar 2012 19:16:33 +0900 Subject: [PATCH] Pass the locale to the native code Change-Id: I8f73b9b33cca56b3fa44ec6259c0896be22f4a47 --- .../com/android/inputmethod/keyboard/Keyboard.java | 2 +- .../inputmethod/keyboard/ProximityInfo.java | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 53467122a..b7f1ddde6 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -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); diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java index 13d18e55a..8a65a5fc6 100644 --- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java +++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java @@ -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 keys, TouchPositionCorrection touchPositionCorrection, Map> 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. emptySet(), + return new ProximityInfo("", 1, 1, 1, 1, 1, 1, Collections. emptySet(), null, Collections.> 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,