aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2013-01-09 21:47:46 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-01-09 21:47:46 -0800
commit6512cd289d4d6bcc835b9da013c3098bf3807bc2 (patch)
tree5a59d75ba7c85ecb9171e169d22455074554910e /java/src
parent759506ef2dad41bf53c65ff090e8f11275669cda (diff)
parentb2f5d1525093e66faa4a46d6cf10c0144fca2041 (diff)
downloadlatinime-6512cd289d4d6bcc835b9da013c3098bf3807bc2.tar.gz
latinime-6512cd289d4d6bcc835b9da013c3098bf3807bc2.tar.xz
latinime-6512cd289d4d6bcc835b9da013c3098bf3807bc2.zip
Merge "Cancel update batch input timer only when point is added"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/PointerTracker.java5
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java18
2 files changed, 15 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index 62e674ad5..036372c37 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -920,8 +920,12 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
final boolean isMajorEvent, final Key key) {
final int gestureTime = (int)(eventTime - sGestureFirstDownTime);
if (mIsDetectingGesture) {
+ final int beforeLength = mGestureStrokeWithPreviewPoints.getLength();
final boolean onValidArea = mGestureStrokeWithPreviewPoints.addPointOnKeyboard(
x, y, gestureTime, isMajorEvent);
+ if (mGestureStrokeWithPreviewPoints.getLength() > beforeLength) {
+ mTimerProxy.startUpdateBatchInputTimer(this);
+ }
// If the move event goes out from valid batch input area, cancel batch input.
if (!onValidArea) {
cancelBatchInput();
@@ -943,7 +947,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
if (DEBUG_MOVE_EVENT) {
printTouchEvent("onMoveEvent:", x, y, eventTime);
}
- mTimerProxy.cancelUpdateBatchInputTimer(this);
if (mIsTrackingCanceled) {
return;
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java b/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
index adf223602..ea03f1bd7 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
@@ -163,6 +163,10 @@ public class GestureStroke {
}
}
+ public int getLength() {
+ return mEventTimes.getLength();
+ }
+
public void onDownEvent(final int x, final int y, final long downTime,
final long gestureFirstDownTime, final long lastTypingTime) {
reset();
@@ -202,7 +206,7 @@ public class GestureStroke {
if (!hasDetectedFastMove()) {
return false;
}
- final int size = mEventTimes.getLength();
+ final int size = getLength();
if (size <= 0) {
return false;
}
@@ -229,7 +233,7 @@ public class GestureStroke {
}
public void duplicateLastPointWith(final int time) {
- final int lastIndex = mEventTimes.getLength() - 1;
+ final int lastIndex = getLength() - 1;
if (lastIndex >= 0) {
final int x = mXCoordinates.get(lastIndex);
final int y = mYCoordinates.get(lastIndex);
@@ -255,7 +259,7 @@ public class GestureStroke {
}
private void appendPoint(final int x, final int y, final int time) {
- final int lastIndex = mEventTimes.getLength() - 1;
+ final int lastIndex = getLength() - 1;
// The point that is created by {@link duplicateLastPointWith(int)} may have later event
// time than the next {@link MotionEvent}. To maintain the monotonicity of the event time,
// drop the successive point here.
@@ -281,7 +285,7 @@ public class GestureStroke {
}
private int detectFastMove(final int x, final int y, final int time) {
- final int size = mEventTimes.getLength();
+ final int size = getLength();
final int lastIndex = size - 1;
final int lastX = mXCoordinates.get(lastIndex);
final int lastY = mYCoordinates.get(lastIndex);
@@ -321,7 +325,7 @@ public class GestureStroke {
*/
public boolean addPointOnKeyboard(final int x, final int y, final int time,
final boolean isMajorEvent) {
- final int size = mEventTimes.getLength();
+ final int size = getLength();
if (size <= 0) {
// Down event
appendPoint(x, y, time);
@@ -348,7 +352,7 @@ public class GestureStroke {
final int pixelsPerSec = pixels * MSEC_PER_SEC;
// Equivalent to (pixels / msecs < mGestureRecognitionThreshold / MSEC_PER_SEC)
if (pixelsPerSec < mGestureRecognitionSpeedThreshold * msecs) {
- mIncrementalRecognitionSize = mEventTimes.getLength();
+ mIncrementalRecognitionSize = getLength();
}
}
@@ -358,7 +362,7 @@ public class GestureStroke {
}
public final void appendAllBatchPoints(final InputPointers out) {
- appendBatchPoints(out, mEventTimes.getLength());
+ appendBatchPoints(out, getLength());
}
public final void appendIncrementalBatchPoints(final InputPointers out) {