aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-02-07 17:07:23 +0900
committerTadashi G. Takaoka <takaoka@google.com>2012-02-08 19:31:35 +0900
commit7a39bd4454664b5c37b30e9b5362ddbcdce3b374 (patch)
treeac512e6148d66ca90c521700bb8bdba8116cdab6 /java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
parent82efc941ba88e680765dac8f34d307780f6527d1 (diff)
downloadlatinime-7a39bd4454664b5c37b30e9b5362ddbcdce3b374.tar.gz
latinime-7a39bd4454664b5c37b30e9b5362ddbcdce3b374.tar.xz
latinime-7a39bd4454664b5c37b30e9b5362ddbcdce3b374.zip
Shift+Smiley key will register newline character of textMultiLine
This change also * Honors the custom action label in EditorInfo.actionLabel. * Invokes InputConnection.performeEditorAction if action is specifed at EditorInfo.imeOptions or actionLabel/actionId. * Stops using InputMethodService.sendKeyChar. Implements sendKeyCodePoint instead. Bug: 2498607 Bug: 5961809 Bug: 5368408 Change-Id: If4cd5eb3dacfc6b6a7ea434b0617c2438e06e42d
Diffstat (limited to 'java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java')
-rw-r--r--java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java58
1 files changed, 25 insertions, 33 deletions
diff --git a/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java b/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
index e1db36088..3247997f6 100644
--- a/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
@@ -67,42 +67,34 @@ public class EditorInfoCompatUtils {
ic.performEditorAction(OBJ_IME_ACTION_PREVIOUS);
}
- public static String imeOptionsName(int imeOptions) {
- if (imeOptions == -1)
- return null;
+ public static String imeActionName(int imeOptions) {
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_NEXT:
- action = "actionNext";
- 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;
+ case EditorInfo.IME_ACTION_UNSPECIFIED:
+ return "actionUnspecified";
+ case EditorInfo.IME_ACTION_NONE:
+ return "actionNone";
+ case EditorInfo.IME_ACTION_GO:
+ return "actionGo";
+ case EditorInfo.IME_ACTION_SEARCH:
+ return "actionSearch";
+ case EditorInfo.IME_ACTION_SEND:
+ return "actionSend";
+ case EditorInfo.IME_ACTION_NEXT:
+ return "actionNext";
+ case EditorInfo.IME_ACTION_DONE:
+ return "actionDone";
+ default:
+ if (OBJ_IME_ACTION_PREVIOUS != null && actionId == OBJ_IME_ACTION_PREVIOUS) {
+ return "actionPrevious";
+ } else {
+ return "actionUnknown(" + actionId + ")";
}
}
+ }
+
+ public static String imeOptionsName(int imeOptions) {
+ final String action = imeActionName(imeOptions);
final StringBuilder flags = new StringBuilder();
if ((imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) {
flags.append("flagNoEnterAction|");
@@ -116,6 +108,6 @@ public class EditorInfoCompatUtils {
if (hasFlagForceAscii(imeOptions)) {
flags.append("flagForceAscii|");
}
- return flags + action;
+ return (action != null) ? flags + action : flags.toString();
}
}