diff options
author | 2013-01-10 00:05:01 -0800 | |
---|---|---|
committer | 2013-01-10 00:05:01 -0800 | |
commit | dce2cdad0a5f9cb4e73953d1de6dae618888f3a0 (patch) | |
tree | 4bf8532ae34af1b4caa961b40fad301d1db7bbb7 /java/src/com/android/inputmethod | |
parent | 01b2510c7c91e3fc6ef744bc066f508deab5e3f9 (diff) | |
parent | d9c7a6b9b32c52b773165f7e177b3511cdc21d2f (diff) | |
download | latinime-dce2cdad0a5f9cb4e73953d1de6dae618888f3a0.tar.gz latinime-dce2cdad0a5f9cb4e73953d1de6dae618888f3a0.tar.xz latinime-dce2cdad0a5f9cb4e73953d1de6dae618888f3a0.zip |
am d9c7a6b9: Merge "Move a method to a utility class (C1)"
* commit 'd9c7a6b9b32c52b773165f7e177b3511cdc21d2f':
Move a method to a utility class (C1)
Diffstat (limited to 'java/src/com/android/inputmethod')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyboardId.java | 15 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/InputTypeUtils.java | 13 |
2 files changed, 16 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java index b41361515..f9ff7b089 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java @@ -59,8 +59,6 @@ public final class KeyboardId { public static final int FORM_FACTOR_TABLET7 = 1; public static final int FORM_FACTOR_TABLET10 = 2; - private static final int IME_ACTION_CUSTOM_LABEL = EditorInfo.IME_MASK_ACTION + 1; - public final InputMethodSubtype mSubtype; public final Locale mLocale; public final int mDeviceFormFactor; @@ -174,19 +172,12 @@ public final class KeyboardId { } public int imeAction() { - final int actionId = mEditorInfo.imeOptions & EditorInfo.IME_MASK_ACTION; - if ((mEditorInfo.imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) { - return EditorInfo.IME_ACTION_NONE; - } else if (mEditorInfo.actionLabel != null) { - return IME_ACTION_CUSTOM_LABEL; - } else { - return actionId; - } + return InputTypeUtils.getActionIdFromEditorInfo(mEditorInfo); } public int imeActionId() { final int actionId = imeAction(); - return actionId == IME_ACTION_CUSTOM_LABEL ? mEditorInfo.actionId : actionId; + return actionId == InputTypeUtils.IME_ACTION_CUSTOM_LABEL ? mEditorInfo.actionId : actionId; } @Override @@ -269,7 +260,7 @@ public final class KeyboardId { } public static String actionName(final int actionId) { - return (actionId == IME_ACTION_CUSTOM_LABEL) ? "actionCustomLabel" + return (actionId == InputTypeUtils.IME_ACTION_CUSTOM_LABEL) ? "actionCustomLabel" : EditorInfoCompatUtils.imeActionName(actionId); } } diff --git a/java/src/com/android/inputmethod/latin/InputTypeUtils.java b/java/src/com/android/inputmethod/latin/InputTypeUtils.java index 9a4503bf4..55414b809 100644 --- a/java/src/com/android/inputmethod/latin/InputTypeUtils.java +++ b/java/src/com/android/inputmethod/latin/InputTypeUtils.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin; import android.text.InputType; +import android.view.inputmethod.EditorInfo; public final class InputTypeUtils implements InputType { private static final int WEB_TEXT_PASSWORD_INPUT_TYPE = @@ -35,6 +36,7 @@ public final class InputTypeUtils implements InputType { InputType.TYPE_TEXT_VARIATION_URI, InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD, InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD }; + public static final int IME_ACTION_CUSTOM_LABEL = EditorInfo.IME_MASK_ACTION + 1; private InputTypeUtils() { // This utility class is not publicly instantiable. @@ -102,4 +104,15 @@ public final class InputTypeUtils implements InputType { } return true; } + + public static int getActionIdFromEditorInfo(final EditorInfo editorInfo) { + final int actionId = editorInfo.imeOptions & EditorInfo.IME_MASK_ACTION; + if ((editorInfo.imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) { + return EditorInfo.IME_ACTION_NONE; + } else if (editorInfo.actionLabel != null) { + return IME_ACTION_CUSTOM_LABEL; + } else { + return actionId; + } + } } |