Fix coordinates sent to native code
Change-Id: I2c8b093b59ad36ffe860c3c4d360d87251d101c4main
parent
231ef8fa3e
commit
691f1c174b
|
@ -65,11 +65,11 @@ public class KeyDetector {
|
||||||
return mKeyHysteresisDistanceSquared;
|
return mKeyHysteresisDistanceSquared;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getTouchX(int x) {
|
public int getTouchX(int x) {
|
||||||
return x + mCorrectionX;
|
return x + mCorrectionX;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getTouchY(int y) {
|
public int getTouchY(int y) {
|
||||||
return y + mCorrectionY;
|
return y + mCorrectionY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,21 +123,27 @@ public class WordComposer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove input keyDetector
|
// TODO: remove input keyDetector
|
||||||
public void add(int primaryCode, int keyX, int keyY, KeyDetector keyDetector) {
|
public void add(int primaryCode, int x, int y, KeyDetector keyDetector) {
|
||||||
final int[] codes;
|
final int[] codes;
|
||||||
if (keyX == KeyboardActionListener.SPELL_CHECKER_COORDINATE
|
final int keyX;
|
||||||
|| keyY == KeyboardActionListener.SPELL_CHECKER_COORDINATE) {
|
final int keyY;
|
||||||
|
if (x == KeyboardActionListener.SPELL_CHECKER_COORDINATE
|
||||||
|
|| y == KeyboardActionListener.SPELL_CHECKER_COORDINATE) {
|
||||||
// only used for tests in InputLogicTests
|
// only used for tests in InputLogicTests
|
||||||
addKeyForSpellChecker(primaryCode, AndroidSpellCheckerService.SCRIPT_LATIN);
|
addKeyForSpellChecker(primaryCode, AndroidSpellCheckerService.SCRIPT_LATIN);
|
||||||
return;
|
return;
|
||||||
} else if (keyX == KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
|
} else if (x == KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
|
||||||
|| keyY == KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
|
|| y == KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
|
||||||
|| keyX == KeyboardActionListener.NOT_A_TOUCH_COORDINATE
|
|| x == KeyboardActionListener.NOT_A_TOUCH_COORDINATE
|
||||||
|| keyY == KeyboardActionListener.NOT_A_TOUCH_COORDINATE) {
|
|| y == KeyboardActionListener.NOT_A_TOUCH_COORDINATE) {
|
||||||
codes = new int[] { primaryCode };
|
codes = new int[] { primaryCode };
|
||||||
|
keyX = x;
|
||||||
|
keyY = y;
|
||||||
} else {
|
} else {
|
||||||
codes = keyDetector.newCodeArray();
|
codes = keyDetector.newCodeArray();
|
||||||
keyDetector.getKeyAndNearbyCodes(keyX, keyY, codes);
|
keyDetector.getKeyAndNearbyCodes(x, y, codes);
|
||||||
|
keyX = keyDetector.getTouchX(x);
|
||||||
|
keyY = keyDetector.getTouchX(y);
|
||||||
}
|
}
|
||||||
add(primaryCode, codes, keyX, keyY);
|
add(primaryCode, codes, keyX, keyY);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue