diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 48 |
1 files changed, 8 insertions, 40 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 741f7f2a1..6935f1946 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1248,11 +1248,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar KeyboardActionListener.SUGGESTION_STRIP_COORDINATE); } - private static int getEditorActionId(EditorInfo editorInfo) { - if (editorInfo == null) return 0; - return (editorInfo.actionLabel != null) - ? editorInfo.actionId - : (editorInfo.imeOptions & EditorInfo.IME_MASK_ACTION); + private static int getActionId(Keyboard keyboard) { + return keyboard != null ? keyboard.mId.imeActionId() : EditorInfo.IME_ACTION_NONE; } private void performeEditorAction(int actionId) { @@ -1318,18 +1315,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mSubtypeSwitcher.switchToShortcutIME(); break; case Keyboard.CODE_ACTION_ENTER: - performeEditorAction(getEditorActionId(getCurrentInputEditorInfo())); + performeEditorAction(getActionId(switcher.getKeyboard())); break; - case Keyboard.CODE_TAB: - handleTab(); - // There are two cases for tab. Either we send a "next" event, that may change the - // focus but will never move the cursor. Or, we send a real tab keycode, which some - // applications may accept or ignore, and we don't know whether this will move the - // cursor or not. So actually, we don't really know. - // So to go with the safer option, we'd rather behave as if the user moved the - // cursor when they didn't than the opposite. We also expect that most applications - // will actually use tab only for focus movement. - // To sum it up: do not update mExpectingUpdateSelection here. + case Keyboard.CODE_ACTION_NEXT: + performeEditorAction(EditorInfo.IME_ACTION_NEXT); + break; + case Keyboard.CODE_ACTION_PREVIOUS: + EditorInfoCompatUtils.performEditorActionPrevious(getCurrentInputConnection()); break; default: mSpaceState = SPACE_STATE_NONE; @@ -1492,30 +1484,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } - // TODO: Implement next and previous actions using other key code than tab's code. - private void handleTab() { - final int imeOptions = getCurrentInputEditorInfo().imeOptions; - if (!EditorInfoCompatUtils.hasFlagNavigateNext(imeOptions) - && !EditorInfoCompatUtils.hasFlagNavigatePrevious(imeOptions)) { - // TODO: This should be {@link #sendKeyCodePoint(int)}. - sendDownUpKeyEvents(KeyEvent.KEYCODE_TAB); - return; - } - - final InputConnection ic = getCurrentInputConnection(); - if (ic == null) - return; - - final Keyboard keyboard = mKeyboardSwitcher.getKeyboard(); - // True if keyboard is in either shift chording or manual shifted state. - final boolean isManualShifted = (keyboard != null && keyboard.isManualShifted()); - if (EditorInfoCompatUtils.hasFlagNavigateNext(imeOptions) && !isManualShifted) { - EditorInfoCompatUtils.performEditorActionNext(ic); - } else if (EditorInfoCompatUtils.hasFlagNavigatePrevious(imeOptions) && isManualShifted) { - EditorInfoCompatUtils.performEditorActionPrevious(ic); - } - } - // ic may be null private boolean maybeStripSpaceWhileInBatchEdit(final InputConnection ic, final int code, final int spaceState, final boolean isFromSuggestionStrip) { |