aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-03-25 12:40:57 -0700
committersatok <satok@google.com>2011-03-25 12:56:57 -0700
commitf1a81f5eb37df4170de2cf6327c860e3d64dc2f8 (patch)
tree7d5c38e8db9d94de0649fb54d2a3e440d5f00d24 /java
parente9957752bcaad048746c7a57bbd2c0a59e1918a0 (diff)
downloadlatinime-f1a81f5eb37df4170de2cf6327c860e3d64dc2f8.tar.gz
latinime-f1a81f5eb37df4170de2cf6327c860e3d64dc2f8.tar.xz
latinime-f1a81f5eb37df4170de2cf6327c860e3d64dc2f8.zip
Move a debug utility function to EditorInfoCompatUtils
- imeOptionName Change-Id: I7a7ea9bee410cedc0ef9b3d2aa4df8260d7f6a35
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java40
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardId.java25
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardParser.java3
3 files changed, 44 insertions, 24 deletions
diff --git a/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java b/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
index 9d83b5463..f6f4f7a59 100644
--- a/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
@@ -56,4 +56,44 @@ public class EditorInfoCompatUtils {
return;
ic.performEditorAction(OBJ_IME_ACTION_PREVIOUS);
}
+
+ public static String imeOptionsName(int imeOptions) {
+ if (imeOptions == -1)
+ return null;
+ final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION;
+ final String action;
+ switch (actionId) {
+ case EditorInfo.IME_ACTION_UNSPECIFIED:
+ action = "actionUnspecified";
+ break;
+ case EditorInfo.IME_ACTION_NONE:
+ action = "actionNone";
+ break;
+ case EditorInfo.IME_ACTION_GO:
+ action = "actionGo";
+ break;
+ case EditorInfo.IME_ACTION_SEARCH:
+ action = "actionSearch";
+ break;
+ case EditorInfo.IME_ACTION_SEND:
+ action = "actionSend";
+ break;
+ case EditorInfo.IME_ACTION_DONE:
+ action = "actionDone";
+ break;
+ default: {
+ if (OBJ_IME_ACTION_PREVIOUS != null && actionId == OBJ_IME_ACTION_PREVIOUS) {
+ action = "actionPrevious";
+ } else {
+ action = "actionUnknown(" + actionId + ")";
+ }
+ break;
+ }
+ }
+ if ((imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) {
+ return "flagNoEnterAction|" + action;
+ } else {
+ return action;
+ }
+ }
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
index 5d8cf7cff..f68b68f1d 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard;
+import com.android.inputmethod.compat.EditorInfoCompatUtils;
import com.android.inputmethod.compat.InputTypeCompatUtils;
import com.android.inputmethod.latin.R;
@@ -140,7 +141,7 @@ public class KeyboardId {
mLocale,
(mOrientation == 1 ? "port" : "land"),
modeName(mMode),
- imeOptionsName(mImeAction),
+ EditorInfoCompatUtils.imeOptionsName(mImeAction),
(mPasswordInput ? " passwordInput" : ""),
(mHasSettingsKey ? " hasSettingsKey" : ""),
(mVoiceKeyEnabled ? " voiceKeyEnabled" : ""),
@@ -170,26 +171,4 @@ public class KeyboardId {
}
return null;
}
-
- public static String imeOptionsName(int imeOptions) {
- if (imeOptions == -1) return null;
- final int actionNo = imeOptions & EditorInfo.IME_MASK_ACTION;
- final String action;
- switch (actionNo) {
- case EditorInfo.IME_ACTION_UNSPECIFIED: action = "actionUnspecified"; break;
- case EditorInfo.IME_ACTION_NONE: action = "actionNone"; break;
- case EditorInfo.IME_ACTION_GO: action = "actionGo"; break;
- case EditorInfo.IME_ACTION_SEARCH: action = "actionSearch"; break;
- case EditorInfo.IME_ACTION_SEND: action = "actionSend"; break;
- case EditorInfo.IME_ACTION_DONE: action = "actionDone"; break;
- case EditorInfo.IME_ACTION_PREVIOUS: action = "actionPrevious"; break;
- default: action = "actionUnknown(" + actionNo + ")"; break;
- }
- if ((imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) {
- return "flagNoEnterAction|" + action;
- } else {
- return action;
- }
- }
}
-
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
index feb56ab3a..62e6f302d 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard;
+import com.android.inputmethod.compat.EditorInfoCompatUtils;
import com.android.inputmethod.latin.R;
import org.xmlpull.v1.XmlPullParser;
@@ -453,7 +454,7 @@ public class KeyboardParser {
booleanAttr(a, R.styleable.Keyboard_Case_hasSettingsKey, "hasSettingsKey"),
booleanAttr(a, R.styleable.Keyboard_Case_voiceKeyEnabled, "voiceKeyEnabled"),
booleanAttr(a, R.styleable.Keyboard_Case_hasVoiceKey, "hasVoiceKey"),
- textAttr(KeyboardId.imeOptionsName(
+ textAttr(EditorInfoCompatUtils.imeOptionsName(
a.getInt(R.styleable.Keyboard_Case_imeAction, -1)), "imeAction"),
textAttr(a.getString(R.styleable.Keyboard_Case_languageCode), "languageCode"),
textAttr(a.getString(R.styleable.Keyboard_Case_countryCode), "countryCode"),