author | bo.cao <bo.cao@amlogic.com> | 2012-06-15 02:30:55 (GMT) |
---|---|---|
committer | bo.cao <bo.cao@amlogic.com> | 2012-06-15 02:30:55 (GMT) |
commit | cf59ae383f4c8488b098acc984840a3df9313be3 (patch) | |
tree | 8a92deb055a35936772caf4e259ad02bd6c8def8 | |
parent | 6e88a093907f536e2557a2fad043d1bb0a714644 (diff) | |
download | RemoteIME-cf59ae383f4c8488b098acc984840a3df9313be3.zip RemoteIME-cf59ae383f4c8488b098acc984840a3df9313be3.tar.gz RemoteIME-cf59ae383f4c8488b098acc984840a3df9313be3.tar.bz2 |
adjust x & y bias correction
-rwxr-xr-x | src/com/amlogic/inputmethod/remote/SkbContainer.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/com/amlogic/inputmethod/remote/SkbContainer.java b/src/com/amlogic/inputmethod/remote/SkbContainer.java index add073a..e858145 100755 --- a/src/com/amlogic/inputmethod/remote/SkbContainer.java +++ b/src/com/amlogic/inputmethod/remote/SkbContainer.java @@ -44,7 +44,15 @@ public class SkbContainer extends RelativeLayout implements OnTouchListener { * simple bias correction. If the input method runs on emulator, no bias * correction will be used. */ - private static final int Y_BIAS_CORRECTION = -10; + private static final int Y_BIAS_CORRECTION = 10; + + /** + * For finger touch, user tends to press the right part of the target key, + * or he/she even presses the area out of it, so it is necessary to make a + * simple bias correction. If the input method runs on emulator, no bias + * correction will be used. + */ + private static final int X_BIAS_CORRECTION = 10; /** * Used to skip these move events whose position is too close to the @@ -146,6 +154,13 @@ public class SkbContainer extends RelativeLayout implements OnTouchListener { private int mYBiasCorrection = 0; /** + * For finger touch, user tends to press the bottom part of the target key, + * or he/she even presses the area out of it, so it is necessary to make a + * simple bias correction in x. + */ + private int mXBiasCorrection = 0; + + /** * The x coordination of the last touch event. */ private int mXLast; @@ -195,8 +210,10 @@ public class SkbContainer extends RelativeLayout implements OnTouchListener { // If it runs on an emulator, no bias correction if ("1".equals(SystemProperties.get("ro.kernel.qemu"))) { mYBiasCorrection = 0; + mYBiasCorrection = 0; } else { mYBiasCorrection = Y_BIAS_CORRECTION; + mXBiasCorrection = X_BIAS_CORRECTION; } mBalloonPopup = new BalloonHint(context, this, MeasureSpec.AT_MOST); if (POPUPWINDOW_FOR_PRESSED_UI) { @@ -443,6 +460,7 @@ public class SkbContainer extends RelativeLayout implements OnTouchListener { int y = (int) event.getY(); // Bias correction y = y + mYBiasCorrection; + x = x + mXBiasCorrection; // Ignore short-distance movement event to get better performance. if (event.getAction() == MotionEvent.ACTION_MOVE) { |