aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-01-17 14:38:00 +0900
committerTadashi G. Takaoka <takaoka@google.com>2012-01-17 14:38:00 +0900
commit1ef6fc7e1519cedec9e84a64968bfba4212d0436 (patch)
tree9fc6bb1a3c8d1d0e62c0219d9270cf3a80a52d91 /java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
parentedf107e2a610c53f419995e8268bf6a333bfdd46 (diff)
downloadlatinime-1ef6fc7e1519cedec9e84a64968bfba4212d0436.tar.gz
latinime-1ef6fc7e1519cedec9e84a64968bfba4212d0436.tar.xz
latinime-1ef6fc7e1519cedec9e84a64968bfba4212d0436.zip
Support EditorInfo.IME_FLAG_FORCE_ASCII
Bug: 5850605 Change-Id: I6665b483f775094903f2e26f5584e4b141592ab5
Diffstat (limited to 'java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java')
-rw-r--r--java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java25
1 files changed, 22 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java b/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
index bcdcef7dc..e1db36088 100644
--- a/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
@@ -26,12 +26,16 @@ public class EditorInfoCompatUtils {
EditorInfo.class, "IME_FLAG_NAVIGATE_NEXT");
private static final Field FIELD_IME_FLAG_NAVIGATE_PREVIOUS = CompatUtils.getField(
EditorInfo.class, "IME_FLAG_NAVIGATE_PREVIOUS");
+ private static final Field FIELD_IME_FLAG_FORCE_ASCII = CompatUtils.getField(
+ EditorInfo.class, "IME_FLAG_FORCE_ASCII");
private static final Field FIELD_IME_ACTION_PREVIOUS = CompatUtils.getField(
EditorInfo.class, "IME_ACTION_PREVIOUS");
private static final Integer OBJ_IME_FLAG_NAVIGATE_NEXT = (Integer) CompatUtils
.getFieldValue(null, null, FIELD_IME_FLAG_NAVIGATE_NEXT);
private static final Integer OBJ_IME_FLAG_NAVIGATE_PREVIOUS = (Integer) CompatUtils
.getFieldValue(null, null, FIELD_IME_FLAG_NAVIGATE_PREVIOUS);
+ private static final Integer OBJ_IME_FLAG_FORCE_ASCII = (Integer) CompatUtils
+ .getFieldValue(null, null, FIELD_IME_FLAG_FORCE_ASCII);
private static final Integer OBJ_IME_ACTION_PREVIOUS = (Integer) CompatUtils
.getFieldValue(null, null, FIELD_IME_ACTION_PREVIOUS);
@@ -47,6 +51,12 @@ public class EditorInfoCompatUtils {
return (imeOptions & OBJ_IME_FLAG_NAVIGATE_PREVIOUS) != 0;
}
+ public static boolean hasFlagForceAscii(int imeOptions) {
+ if (OBJ_IME_FLAG_FORCE_ASCII == null)
+ return false;
+ return (imeOptions & OBJ_IME_FLAG_FORCE_ASCII) != 0;
+ }
+
public static void performEditorActionNext(InputConnection ic) {
ic.performEditorAction(EditorInfo.IME_ACTION_NEXT);
}
@@ -93,10 +103,19 @@ public class EditorInfoCompatUtils {
break;
}
}
+ final StringBuilder flags = new StringBuilder();
if ((imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) {
- return "flagNoEnterAction|" + action;
- } else {
- return action;
+ flags.append("flagNoEnterAction|");
+ }
+ if (hasFlagNavigateNext(imeOptions)) {
+ flags.append("flagNavigateNext|");
+ }
+ if (hasFlagNavigatePrevious(imeOptions)) {
+ flags.append("flagNavigatePrevious|");
+ }
+ if (hasFlagForceAscii(imeOptions)) {
+ flags.append("flagForceAscii|");
}
+ return flags + action;
}
}