am 3e0c82ec: Fix for 2568664 : Slide gesture on spacebar is not reliable anymore
Merge commit '3e0c82ec80a69c4adbd60546c3c56c83c43ec7eb' into froyo-plus-aosp * commit '3e0c82ec80a69c4adbd60546c3c56c83c43ec7eb': Fix for 2568664 : Slide gesture on spacebar is not reliable anymoremain
commit
4f695092a2
|
@ -63,6 +63,8 @@ public class LatinKeyboardView extends KeyboardView {
|
||||||
private boolean mDisableDisambiguation;
|
private boolean mDisableDisambiguation;
|
||||||
/** The distance threshold at which we start treating the touch session as a multi-touch */
|
/** The distance threshold at which we start treating the touch session as a multi-touch */
|
||||||
private int mJumpThresholdSquare = Integer.MAX_VALUE;
|
private int mJumpThresholdSquare = Integer.MAX_VALUE;
|
||||||
|
/** The y coordinate of the last row */
|
||||||
|
private int mLastRowY;
|
||||||
|
|
||||||
public LatinKeyboardView(Context context, AttributeSet attrs) {
|
public LatinKeyboardView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
@ -82,6 +84,8 @@ public class LatinKeyboardView extends KeyboardView {
|
||||||
// One-seventh of the keyboard width seems like a reasonable threshold
|
// One-seventh of the keyboard width seems like a reasonable threshold
|
||||||
mJumpThresholdSquare = k.getMinWidth() / 7;
|
mJumpThresholdSquare = k.getMinWidth() / 7;
|
||||||
mJumpThresholdSquare *= mJumpThresholdSquare;
|
mJumpThresholdSquare *= mJumpThresholdSquare;
|
||||||
|
// Assuming there are 4 rows, this is the coordinate of the last row
|
||||||
|
mLastRowY = (k.getHeight() * 3) / 4;
|
||||||
setKeyboardLocal(k);
|
setKeyboardLocal(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +143,11 @@ public class LatinKeyboardView extends KeyboardView {
|
||||||
case MotionEvent.ACTION_MOVE:
|
case MotionEvent.ACTION_MOVE:
|
||||||
// Is this a big jump?
|
// Is this a big jump?
|
||||||
final int distanceSquare = (mLastX - x) * (mLastX - x) + (mLastY - y) * (mLastY - y);
|
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 we're not yet dropping events, start dropping and send an UP event
|
||||||
if (!mDroppingEvents) {
|
if (!mDroppingEvents) {
|
||||||
mDroppingEvents = true;
|
mDroppingEvents = true;
|
||||||
|
|
Loading…
Reference in New Issue