aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-12-27 16:43:07 +0900
committerJean Chalard <jchalard@google.com>2014-01-22 14:44:27 +0900
commita91dfff5e54f68c4003327eeca47286084c35a2f (patch)
tree4883941e180ffff8e06d69f1d2ca67521a21dd15 /java
parent352286a43b0f951a5082ca741c2bd7f501f48c81 (diff)
downloadlatinime-a91dfff5e54f68c4003327eeca47286084c35a2f.tar.gz
latinime-a91dfff5e54f68c4003327eeca47286084c35a2f.tar.xz
latinime-a91dfff5e54f68c4003327eeca47286084c35a2f.zip
[IL65] Pull up X,Y processing, step 4
This works because getKey{X,Y} is a no-op on Constants.NOT_A_COORDINATE. Bug: 8636060 Change-Id: I2f7dd96b6011f094110f7978f8ff24ef2a6e2585
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java6
-rw-r--r--java/src/com/android/inputmethod/keyboard/PointerTracker.java7
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java11
3 files changed, 13 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java
index 5b13e9a41..1891dfc74 100644
--- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java
@@ -142,7 +142,11 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
if (code == Constants.CODE_OUTPUT_TEXT) {
mListener.onTextInput(mCurrentKey.getOutputText());
} else if (code != Constants.CODE_UNSPECIFIED) {
- mListener.onCodeInput(code, x, y);
+ if (getKeyboard().hasProximityCharsCorrection(code)) {
+ mListener.onCodeInput(code, x, y);
+ } else {
+ mListener.onCodeInput(code, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
+ }
}
}
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index 5e02926de..093155049 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -346,7 +346,12 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
if (code == Constants.CODE_OUTPUT_TEXT) {
sListener.onTextInput(key.getOutputText());
} else if (code != Constants.CODE_UNSPECIFIED) {
- sListener.onCodeInput(code, x, y);
+ if (mKeyboard.hasProximityCharsCorrection(code)) {
+ sListener.onCodeInput(code, x, y);
+ } else {
+ sListener.onCodeInput(code,
+ Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
+ }
}
}
}
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 0f40e1365..aca361905 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1247,21 +1247,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Implementation of {@link KeyboardActionListener}.
@Override
public void onCodeInput(final int codePoint, final int x, final int y) {
- final int keyX, keyY;
- final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
// x and y include some padding, but everything down the line (especially native
// code) needs the coordinates in the keyboard frame.
// TODO: We should reconsider which coordinate system should be used to represent
// keyboard event. Also we should pull this up -- LatinIME has no business doing
// this transformation, it should be done already before calling onCodeInput.
- if (keyboard != null && keyboard.hasProximityCharsCorrection(codePoint)) {
- keyX = mainKeyboardView.getKeyX(x);
- keyY = mainKeyboardView.getKeyY(y);
- } else {
- keyX = Constants.NOT_A_COORDINATE;
- keyY = Constants.NOT_A_COORDINATE;
- }
+ final int keyX = mainKeyboardView.getKeyX(x);
+ final int keyY = mainKeyboardView.getKeyY(y);
mInputLogic.onCodeInput(codePoint, keyX, keyY, mHandler, mKeyboardSwitcher,
mSubtypeSwitcher);
}