aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-01-18 11:18:32 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-01-18 11:18:32 +0000
commit2e680c890d198f2f32d4ae1a46b0431b61227db2 (patch)
treee28fc675c5ffc9cef8981a6c390c1dbf41228493 /java/src
parentd5e869ced838454ede1d813d6a289fafc31b0665 (diff)
parentb4ac04ae4891d74a7cabd6438a1369624255fc13 (diff)
downloadlatinime-2e680c890d198f2f32d4ae1a46b0431b61227db2.tar.gz
latinime-2e680c890d198f2f32d4ae1a46b0431b61227db2.tar.xz
latinime-2e680c890d198f2f32d4ae1a46b0431b61227db2.zip
Merge "Trigger the set action when pressing hardware enter (C2)"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java b/java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java
index 2fb7fe8b4..a2463c20c 100644
--- a/java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java
+++ b/java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java
@@ -55,13 +55,20 @@ public class HardwareKeyboardEventDecoder implements HardwareEventDecoder {
// A dead key.
return Event.createDeadEvent(
codePointAndFlags & KeyCharacterMap.COMBINING_ACCENT_MASK, null /* next */);
- } else {
- // A committable character. This should be committed right away, taking into
- // account the current state.
- return Event.createCommittableEvent(codePointAndFlags, null /* next */);
}
- } else {
- return Event.createNotHandledEvent();
+ if (KeyEvent.KEYCODE_ENTER == keyCode) {
+ // The Enter key. If the Shift key is not being pressed, this should send a
+ // CODE_ACTION_ENTER to trigger the action if any, or a carriage return
+ // otherwise. If the Shift key is depressed, this should send a
+ // CODE_SHIFT_ENTER and let Latin IME decide what to do with it.
+ return Event.createCommittableEvent(keyEvent.isShiftPressed()
+ ? Constants.CODE_SHIFT_ENTER : Constants.CODE_ACTION_ENTER,
+ null /* next */);
+ }
+ // If not Enter, then we have a committable character. This should be committed
+ // right away, taking into account the current state.
+ return Event.createCommittableEvent(codePointAndFlags, null /* next */);
}
+ return Event.createNotHandledEvent();
}
}