aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-02-16 23:14:14 -0800
committerTadashi G. Takaoka <takaoka@google.com>2012-02-21 22:50:50 -0800
commit05bfd189a88be79ddfc74d0ea21792e2fb78f2aa (patch)
tree106c9ad68728c8a63d5a055dcd82c91bf8172a61 /java/src/com/android/inputmethod/latin/LatinIME.java
parent97bde43740d8ba7f8aedde35d20621823140966c (diff)
downloadlatinime-05bfd189a88be79ddfc74d0ea21792e2fb78f2aa.tar.gz
latinime-05bfd189a88be79ddfc74d0ea21792e2fb78f2aa.tar.xz
latinime-05bfd189a88be79ddfc74d0ea21792e2fb78f2aa.zip
Add next/prev navigate action more keys and remove tab key
Bug: 6037537 Bug: 5961814 Change-Id: I9c6dedf953452a180fcd5bce7bfadfd3c821f224
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java48
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 730992b13..aef248e19 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1232,11 +1232,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) {
@@ -1302,18 +1299,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;
@@ -1488,30 +1480,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) {