Loading java/src/com/android/inputmethod/keyboard/KeyboardId.java +3 −12 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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); } } java/src/com/android/inputmethod/latin/InputTypeUtils.java +13 −0 Original line number Diff line number Diff line Loading @@ -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 = Loading @@ -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. Loading Loading @@ -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; } } } Loading
java/src/com/android/inputmethod/keyboard/KeyboardId.java +3 −12 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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); } }
java/src/com/android/inputmethod/latin/InputTypeUtils.java +13 −0 Original line number Diff line number Diff line Loading @@ -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 = Loading @@ -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. Loading Loading @@ -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; } } }