aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2010-04-06 06:27:17 -0700
committerAmith Yamasani <yamasani@google.com>2010-04-06 11:14:03 -0700
commit3e0c82ec80a69c4adbd60546c3c56c83c43ec7eb (patch)
tree7380c39136703567deef3c5469c5e4fab32476fd /java/src/com/android/inputmethod/latin/LatinKeyboardView.java
parentdad0e792aa064765901224af56d2a53a25bc7b7d (diff)
downloadlatinime-3e0c82ec80a69c4adbd60546c3c56c83c43ec7eb.tar.gz
latinime-3e0c82ec80a69c4adbd60546c3c56c83c43ec7eb.tar.xz
latinime-3e0c82ec80a69c4adbd60546c3c56c83c43ec7eb.zip
Fix for 2568664 : Slide gesture on spacebar is not reliable anymore
This was due to the multi-touch error correction code that was recently added. Make sure that one of the move points is in the upper 3 rows to allow for fast swipe on spacebar. Change-Id: I420bdb83a4cd8833c4158bc37a2d806b8c83b948
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinKeyboardView.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboardView.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
index 1e90dccab..06d900f87 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
@@ -63,6 +63,8 @@ public class LatinKeyboardView extends KeyboardView {
private boolean mDisableDisambiguation;
/** The distance threshold at which we start treating the touch session as a multi-touch */
private int mJumpThresholdSquare = Integer.MAX_VALUE;
+ /** The y coordinate of the last row */
+ private int mLastRowY;
public LatinKeyboardView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -82,6 +84,8 @@ public class LatinKeyboardView extends KeyboardView {
// One-seventh of the keyboard width seems like a reasonable threshold
mJumpThresholdSquare = k.getMinWidth() / 7;
mJumpThresholdSquare *= mJumpThresholdSquare;
+ // Assuming there are 4 rows, this is the coordinate of the last row
+ mLastRowY = (k.getHeight() * 3) / 4;
setKeyboardLocal(k);
}
@@ -139,7 +143,11 @@ public class LatinKeyboardView extends KeyboardView {
case MotionEvent.ACTION_MOVE:
// Is this a big jump?
final int distanceSquare = (mLastX - x) * (mLastX - x) + (mLastY - y) * (mLastY - y);
- if (distanceSquare > mJumpThresholdSquare) {
+ // Check the distance and also if the move is not entirely within the bottom row
+ // If it's only in the bottom row, it might be an intentional slide gesture
+ // for language switching
+ if (distanceSquare > mJumpThresholdSquare
+ && (mLastY < mLastRowY || y < mLastRowY)) {
// If we're not yet dropping events, start dropping and send an UP event
if (!mDroppingEvents) {
mDroppingEvents = true;