aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java30
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSet.java12
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java4
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java6
4 files changed, 19 insertions, 33 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 962379016..bc48b85ef 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -278,6 +278,7 @@ public class Keyboard {
}
}
+ // TODO: Remove this method.
public void setEnabled(boolean enabled) {
mEnabled = enabled;
}
@@ -616,29 +617,10 @@ public class Keyboard {
mParams = params;
- setTouchPositionCorrectionData(context, params);
-
params.GRID_WIDTH = res.getInteger(R.integer.config_keyboard_grid_width);
params.GRID_HEIGHT = res.getInteger(R.integer.config_keyboard_grid_height);
}
- private static void setTouchPositionCorrectionData(Context context, Params params) {
- final TypedArray a = context.obtainStyledAttributes(
- null, R.styleable.Keyboard, R.attr.keyboardStyle, 0);
- params.mThemeId = a.getInt(R.styleable.Keyboard_themeId, 0);
- final int resourceId = a.getResourceId(
- R.styleable.Keyboard_touchPositionCorrectionData, 0);
- a.recycle();
- if (resourceId == 0) {
- if (LatinImeLogger.sDBG)
- Log.e(BUILDER_TAG, "touchPositionCorrectionData is not defined");
- return;
- }
-
- final String[] data = context.getResources().getStringArray(resourceId);
- params.mTouchPositionCorrection.load(data);
- }
-
public void setAutoGenerate(KeyboardSet.KeysCache keysCache) {
mParams.mKeysCache = keysCache;
}
@@ -660,6 +642,7 @@ public class Keyboard {
return this;
}
+ // TODO: Remove this method.
public void setTouchPositionCorrectionEnabled(boolean enabled) {
mParams.mTouchPositionCorrection.setEnabled(enabled);
}
@@ -771,6 +754,15 @@ public class Keyboard {
R.styleable.Keyboard_Key_maxMoreKeysColumn, 5);
params.mIconsSet.loadIcons(keyboardAttr);
+
+ params.mThemeId = keyboardAttr.getInt(R.styleable.Keyboard_themeId, 0);
+ final int resourceId = keyboardAttr.getResourceId(
+ R.styleable.Keyboard_touchPositionCorrectionData, 0);
+ params.mTouchPositionCorrection.setEnabled(resourceId != 0);
+ if (resourceId != 0) {
+ final String[] data = mResources.getStringArray(resourceId);
+ params.mTouchPositionCorrection.load(data);
+ }
} finally {
keyAttr.recycle();
keyboardAttr.recycle();
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java b/java/src/com/android/inputmethod/keyboard/KeyboardSet.java
index 52096c843..bb11a9b77 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSet.java
@@ -63,8 +63,6 @@ public class KeyboardSet {
new HashMap<KeyboardId, SoftReference<Keyboard>>();
private static final KeysCache sKeysCache = new KeysCache();
- private static final EditorInfo EMPTY_EDITOR_INFO = new EditorInfo();
-
public static class KeyboardSetException extends RuntimeException {
public final KeyboardId mKeyboardId;
public KeyboardSetException(Throwable cause, KeyboardId keyboardId) {
@@ -209,6 +207,8 @@ public class KeyboardSet {
private final Params mParams = new Params();
+ private static final EditorInfo EMPTY_EDITOR_INFO = new EditorInfo();
+
public Builder(Context context, EditorInfo editorInfo) {
mContext = context;
mPackageName = context.getPackageName();
@@ -229,15 +229,13 @@ public class KeyboardSet {
}
// TODO: Use InputMethodSubtype object as argument.
- public Builder setSubtype(Locale inputLocale, boolean asciiCapable,
- boolean touchPositionCorrectionEnabled) {
+ public Builder setSubtype(Locale inputLocale, boolean asciiCapable) {
final boolean deprecatedForceAscii = StringUtils.inPrivateImeOptions(
mPackageName, LatinIME.IME_OPTION_FORCE_ASCII, mEditorInfo);
final boolean forceAscii = EditorInfoCompatUtils.hasFlagForceAscii(
mParams.mEditorInfo.imeOptions)
|| deprecatedForceAscii;
mParams.mLocale = (forceAscii && !asciiCapable) ? Locale.US : inputLocale;
- mParams.mTouchPositionCorrectionEnabled = touchPositionCorrectionEnabled;
return this;
}
@@ -255,6 +253,10 @@ public class KeyboardSet {
return this;
}
+ public void setTouchPositionCorrectionEnabled(boolean enabled) {
+ mParams.mTouchPositionCorrectionEnabled = enabled;
+ }
+
public KeyboardSet build() {
if (mParams.mOrientation == Configuration.ORIENTATION_UNDEFINED)
throw new RuntimeException("Screen geometry is not specified");
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 42dd6206c..93d8704de 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -140,9 +140,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
builder.setSubtype(
mSubtypeSwitcher.getInputLocale(),
mSubtypeSwitcher.currentSubtypeContainsExtraValueKey(
- LatinIME.SUBTYPE_EXTRA_VALUE_ASCII_CAPABLE),
- mSubtypeSwitcher.currentSubtypeContainsExtraValueKey(
- LatinIME.SUBTYPE_EXTRA_VALUE_SUPPORT_TOUCH_POSITION_CORRECTION));
+ LatinIME.SUBTYPE_EXTRA_VALUE_ASCII_CAPABLE));
builder.setOptions(
settingsValues.isVoiceKeyEnabled(editorInfo),
settingsValues.isVoiceKeyOnMain(),
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 0669ee668..86c153958 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -125,12 +125,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
public static final String SUBTYPE_EXTRA_VALUE_ASCII_CAPABLE = "AsciiCapable";
/**
- * The subtype extra value used to indicate that the subtype keyboard layout supports touch
- * position correction.
- */
- public static final String SUBTYPE_EXTRA_VALUE_SUPPORT_TOUCH_POSITION_CORRECTION =
- "SupportTouchPositionCorrection";
- /**
* The subtype extra value used to indicate that the subtype keyboard layout should be loaded
* from the specified locale.
*/