aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-03-12 16:41:45 +0900
committerJean Chalard <jchalard@google.com>2014-03-13 18:41:02 +0900
commita79a3265db6482a0bcaf0dfa87036a9243af281d (patch)
tree3d84062b5b47ed27be7b7c2096a6a10dd04f4ca1 /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
parent66dce6003f8f1e45eb23c6e2cc273ba07e3065cd (diff)
downloadlatinime-a79a3265db6482a0bcaf0dfa87036a9243af281d.tar.gz
latinime-a79a3265db6482a0bcaf0dfa87036a9243af281d.tar.xz
latinime-a79a3265db6482a0bcaf0dfa87036a9243af281d.zip
[CB02] Pass an Event to onCodeInput.
Bug: 13406701 Change-Id: Id82e9aab6544ca308e6ac6dee2cfa018b9ce2d8f
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index dd9d6e8a9..f7e528648 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -27,6 +27,7 @@ import android.view.inputmethod.CorrectionInfo;
import android.view.inputmethod.EditorInfo;
import com.android.inputmethod.compat.SuggestionSpanUtils;
+import com.android.inputmethod.event.Event;
import com.android.inputmethod.event.EventInterpreter;
import com.android.inputmethod.event.InputTransaction;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
@@ -205,9 +206,9 @@ public final class InputLogic {
LatinImeLogger.logOnManualSuggestion("", suggestion, index, suggestedWords);
// Rely on onCodeInput to do the complicated swapping/stripping logic consistently.
final int primaryCode = suggestion.charAt(0);
- onCodeInput(settingsValues, primaryCode,
- Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE,
- keyboardSwitcher.getKeyboardShiftMode(), handler);
+ final Event event = Event.createSoftwareKeypressEvent(primaryCode, Event.NOT_A_KEY_CODE,
+ Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE);
+ onCodeInput(settingsValues, event, keyboardSwitcher.getKeyboardShiftMode(), handler);
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_punctuationSuggestion(index, suggestion,
false /* isBatchMode */, suggestedWords.mIsPrediction);
@@ -354,17 +355,21 @@ public final class InputLogic {
* the entry point for gesture input; see the onBatchInput* family of functions for this.
*
* @param settingsValues the current settings values.
- * @param code the code to handle. It may be a code point, or an internal key code.
- * @param x the x-coordinate where the user pressed the key, or NOT_A_COORDINATE.
- * @param y the y-coordinate where the user pressed the key, or NOT_A_COORDINATE.
+ * @param event the event to handle.
* @param keyboardShiftMode the current shift mode of the keyboard, as returned by
* {@link com.android.inputmethod.keyboard.KeyboardSwitcher#getKeyboardShiftMode()}
* @return the complete transaction object
*/
- public InputTransaction onCodeInput(final SettingsValues settingsValues, final int code,
- final int x, final int y, final int keyboardShiftMode,
+ public InputTransaction onCodeInput(final SettingsValues settingsValues, final Event event,
+ final int keyboardShiftMode,
// TODO: remove this argument
final LatinIME.UIHandler handler) {
+ // TODO: rework the following to not squash the keycode and the code point into the same
+ // var because it's confusing. Instead the switch() should handle this in a readable manner.
+ final int code =
+ Event.NOT_A_CODE_POINT == event.mCodePoint ? event.mKeyCode : event.mCodePoint;
+ final int x = event.mX;
+ final int y = event.mY;
final InputTransaction inputTransaction = new InputTransaction(settingsValues, code, x, y,
SystemClock.uptimeMillis(), mSpaceState,
getActualCapsMode(settingsValues, keyboardShiftMode));