am a91dfff5: [IL65] Pull up X,Y processing, step 4

* commit 'a91dfff5e54f68c4003327eeca47286084c35a2f':
  [IL65] Pull up X,Y processing, step 4
main
Jean Chalard 2014-01-22 18:44:50 -08:00 committed by Android Git Automerger
commit 05d9fcff2d
3 changed files with 13 additions and 11 deletions

View File

@ -142,7 +142,11 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
if (code == Constants.CODE_OUTPUT_TEXT) { if (code == Constants.CODE_OUTPUT_TEXT) {
mListener.onTextInput(mCurrentKey.getOutputText()); mListener.onTextInput(mCurrentKey.getOutputText());
} else if (code != Constants.CODE_UNSPECIFIED) { } 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);
}
} }
} }

View File

@ -346,7 +346,12 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
if (code == Constants.CODE_OUTPUT_TEXT) { if (code == Constants.CODE_OUTPUT_TEXT) {
sListener.onTextInput(key.getOutputText()); sListener.onTextInput(key.getOutputText());
} else if (code != Constants.CODE_UNSPECIFIED) { } 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);
}
} }
} }
} }

View File

@ -1247,21 +1247,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Implementation of {@link KeyboardActionListener}. // Implementation of {@link KeyboardActionListener}.
@Override @Override
public void onCodeInput(final int codePoint, final int x, final int y) { 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(); final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
// x and y include some padding, but everything down the line (especially native // x and y include some padding, but everything down the line (especially native
// code) needs the coordinates in the keyboard frame. // code) needs the coordinates in the keyboard frame.
// TODO: We should reconsider which coordinate system should be used to represent // 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 // keyboard event. Also we should pull this up -- LatinIME has no business doing
// this transformation, it should be done already before calling onCodeInput. // this transformation, it should be done already before calling onCodeInput.
if (keyboard != null && keyboard.hasProximityCharsCorrection(codePoint)) { final int keyX = mainKeyboardView.getKeyX(x);
keyX = mainKeyboardView.getKeyX(x); final int keyY = mainKeyboardView.getKeyY(y);
keyY = mainKeyboardView.getKeyY(y);
} else {
keyX = Constants.NOT_A_COORDINATE;
keyY = Constants.NOT_A_COORDINATE;
}
mInputLogic.onCodeInput(codePoint, keyX, keyY, mHandler, mKeyboardSwitcher, mInputLogic.onCodeInput(codePoint, keyX, keyY, mHandler, mKeyboardSwitcher,
mSubtypeSwitcher); mSubtypeSwitcher);
} }