2012-07-18 05:27:51 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 The Android Open Source Project
|
|
|
|
*
|
2013-01-21 12:52:57 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2012-07-18 05:27:51 +00:00
|
|
|
*
|
2013-01-21 12:52:57 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2012-07-18 05:27:51 +00:00
|
|
|
*
|
2013-01-21 12:52:57 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2012-07-18 05:27:51 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
package com.android.inputmethod.keyboard.internal;
|
|
|
|
|
2012-09-21 03:15:02 +00:00
|
|
|
import android.util.Log;
|
|
|
|
|
2012-07-18 05:27:51 +00:00
|
|
|
import com.android.inputmethod.latin.InputPointers;
|
2013-06-23 16:11:32 +00:00
|
|
|
import com.android.inputmethod.latin.utils.ResizableIntArray;
|
2012-07-18 05:27:51 +00:00
|
|
|
|
2013-12-24 09:31:49 +00:00
|
|
|
/**
|
|
|
|
* This class holds event points to recognize a gesture stroke.
|
|
|
|
* TODO: Should be final and package private class.
|
|
|
|
*/
|
|
|
|
public class GestureStrokeRecognitionPoints {
|
|
|
|
private static final String TAG = GestureStrokeRecognitionPoints.class.getSimpleName();
|
2012-09-21 03:15:02 +00:00
|
|
|
private static final boolean DEBUG = false;
|
2012-09-27 10:01:17 +00:00
|
|
|
private static final boolean DEBUG_SPEED = false;
|
2012-09-21 03:15:02 +00:00
|
|
|
|
2012-11-22 06:39:28 +00:00
|
|
|
// The height of extra area above the keyboard to draw gesture trails.
|
|
|
|
// Proportional to the keyboard height.
|
|
|
|
public static final float EXTRA_GESTURE_TRAIL_AREA_ABOVE_KEYBOARD_RATIO = 0.25f;
|
|
|
|
|
2012-07-18 11:31:09 +00:00
|
|
|
public static final int DEFAULT_CAPACITY = 128;
|
|
|
|
|
2012-07-18 05:27:51 +00:00
|
|
|
private final int mPointerId;
|
2012-07-20 07:24:54 +00:00
|
|
|
private final ResizableIntArray mEventTimes = new ResizableIntArray(DEFAULT_CAPACITY);
|
|
|
|
private final ResizableIntArray mXCoordinates = new ResizableIntArray(DEFAULT_CAPACITY);
|
|
|
|
private final ResizableIntArray mYCoordinates = new ResizableIntArray(DEFAULT_CAPACITY);
|
2012-09-21 03:15:02 +00:00
|
|
|
|
2013-12-24 09:31:49 +00:00
|
|
|
private final GestureStrokeRecognitionParams mRecognitionParams;
|
2012-10-05 03:12:54 +00:00
|
|
|
|
2012-09-27 10:01:17 +00:00
|
|
|
private int mKeyWidth; // pixel
|
2012-11-22 06:39:28 +00:00
|
|
|
private int mMinYCoordinate; // pixel
|
|
|
|
private int mMaxYCoordinate; // pixel
|
2012-09-27 10:01:17 +00:00
|
|
|
// Static threshold for starting gesture detection
|
2012-09-21 03:15:02 +00:00
|
|
|
private int mDetectFastMoveSpeedThreshold; // pixel /sec
|
|
|
|
private int mDetectFastMoveTime;
|
|
|
|
private int mDetectFastMoveX;
|
|
|
|
private int mDetectFastMoveY;
|
2012-09-27 10:01:17 +00:00
|
|
|
// Dynamic threshold for gesture after fast typing
|
|
|
|
private boolean mAfterFastTyping;
|
|
|
|
private int mGestureDynamicDistanceThresholdFrom; // pixel
|
|
|
|
private int mGestureDynamicDistanceThresholdTo; // pixel
|
|
|
|
// Variables for gesture sampling
|
|
|
|
private int mGestureSamplingMinimumDistance; // pixel
|
|
|
|
private long mLastMajorEventTime;
|
|
|
|
private int mLastMajorEventX;
|
|
|
|
private int mLastMajorEventY;
|
|
|
|
// Variables for gesture recognition
|
|
|
|
private int mGestureRecognitionSpeedThreshold; // pixel / sec
|
|
|
|
private int mIncrementalRecognitionSize;
|
|
|
|
private int mLastIncrementalBatchSize;
|
2012-07-18 05:27:51 +00:00
|
|
|
|
2012-09-27 10:01:17 +00:00
|
|
|
private static final int MSEC_PER_SEC = 1000;
|
2012-09-20 05:16:15 +00:00
|
|
|
|
2013-12-24 09:31:49 +00:00
|
|
|
public GestureStrokeRecognitionPoints(final int pointerId,
|
|
|
|
final GestureStrokeRecognitionParams recognitionParams) {
|
2012-07-18 05:27:51 +00:00
|
|
|
mPointerId = pointerId;
|
2013-12-24 09:31:49 +00:00
|
|
|
mRecognitionParams = recognitionParams;
|
2012-07-18 05:27:51 +00:00
|
|
|
}
|
|
|
|
|
2012-11-22 06:39:28 +00:00
|
|
|
public void setKeyboardGeometry(final int keyWidth, final int keyboardHeight) {
|
2012-09-21 03:15:02 +00:00
|
|
|
mKeyWidth = keyWidth;
|
2012-11-22 06:39:28 +00:00
|
|
|
mMinYCoordinate = -(int)(keyboardHeight * EXTRA_GESTURE_TRAIL_AREA_ABOVE_KEYBOARD_RATIO);
|
2013-05-10 03:16:44 +00:00
|
|
|
mMaxYCoordinate = keyboardHeight;
|
2012-07-19 05:47:55 +00:00
|
|
|
// TODO: Find an appropriate base metric for these length. Maybe diagonal length of the key?
|
2013-12-24 09:31:49 +00:00
|
|
|
mDetectFastMoveSpeedThreshold = (int)(
|
|
|
|
keyWidth * mRecognitionParams.mDetectFastMoveSpeedThreshold);
|
|
|
|
mGestureDynamicDistanceThresholdFrom = (int)(
|
|
|
|
keyWidth * mRecognitionParams.mDynamicDistanceThresholdFrom);
|
|
|
|
mGestureDynamicDistanceThresholdTo = (int)(
|
|
|
|
keyWidth * mRecognitionParams.mDynamicDistanceThresholdTo);
|
|
|
|
mGestureSamplingMinimumDistance = (int)(
|
|
|
|
keyWidth * mRecognitionParams.mSamplingMinimumDistance);
|
|
|
|
mGestureRecognitionSpeedThreshold = (int)(
|
|
|
|
keyWidth * mRecognitionParams.mRecognitionSpeedThreshold);
|
2012-09-21 03:15:02 +00:00
|
|
|
if (DEBUG) {
|
2012-09-27 10:01:17 +00:00
|
|
|
Log.d(TAG, String.format(
|
|
|
|
"[%d] setKeyboardGeometry: keyWidth=%3d tT=%3d >> %3d tD=%3d >> %3d",
|
|
|
|
mPointerId, keyWidth,
|
2013-12-24 09:31:49 +00:00
|
|
|
mRecognitionParams.mDynamicTimeThresholdFrom,
|
|
|
|
mRecognitionParams.mDynamicTimeThresholdTo,
|
2012-09-27 10:01:17 +00:00
|
|
|
mGestureDynamicDistanceThresholdFrom,
|
|
|
|
mGestureDynamicDistanceThresholdTo));
|
2012-09-21 03:15:02 +00:00
|
|
|
}
|
2012-07-18 05:27:51 +00:00
|
|
|
}
|
|
|
|
|
2013-01-10 01:34:20 +00:00
|
|
|
public int getLength() {
|
|
|
|
return mEventTimes.getLength();
|
|
|
|
}
|
|
|
|
|
2013-12-24 09:55:47 +00:00
|
|
|
public void onDownEvent(final int x, final int y, final int elapsedTimeSinceFirstDown,
|
|
|
|
final int elapsedTimeSinceLastTyping) {
|
2012-09-27 10:01:17 +00:00
|
|
|
reset();
|
2013-12-24 09:55:47 +00:00
|
|
|
if (elapsedTimeSinceLastTyping < mRecognitionParams.mStaticTimeThresholdAfterFastTyping) {
|
2012-09-25 05:23:23 +00:00
|
|
|
mAfterFastTyping = true;
|
|
|
|
}
|
|
|
|
if (DEBUG) {
|
2012-09-27 10:01:17 +00:00
|
|
|
Log.d(TAG, String.format("[%d] onDownEvent: dT=%3d%s", mPointerId,
|
2013-12-24 09:55:47 +00:00
|
|
|
elapsedTimeSinceLastTyping, mAfterFastTyping ? " afterFastTyping" : ""));
|
2012-09-25 05:23:23 +00:00
|
|
|
}
|
2013-12-24 09:55:47 +00:00
|
|
|
addPointOnKeyboard(x, y, elapsedTimeSinceFirstDown, true /* isMajorEvent */);
|
2012-09-25 05:23:23 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 10:01:17 +00:00
|
|
|
private int getGestureDynamicDistanceThreshold(final int deltaTime) {
|
2013-12-24 09:31:49 +00:00
|
|
|
if (!mAfterFastTyping || deltaTime >= mRecognitionParams.mDynamicThresholdDecayDuration) {
|
2012-09-27 10:01:17 +00:00
|
|
|
return mGestureDynamicDistanceThresholdTo;
|
2012-09-25 05:23:23 +00:00
|
|
|
}
|
|
|
|
final int decayedThreshold =
|
2012-09-27 10:01:17 +00:00
|
|
|
(mGestureDynamicDistanceThresholdFrom - mGestureDynamicDistanceThresholdTo)
|
2013-12-24 09:31:49 +00:00
|
|
|
* deltaTime / mRecognitionParams.mDynamicThresholdDecayDuration;
|
2012-09-27 10:01:17 +00:00
|
|
|
return mGestureDynamicDistanceThresholdFrom - decayedThreshold;
|
|
|
|
}
|
|
|
|
|
|
|
|
private int getGestureDynamicTimeThreshold(final int deltaTime) {
|
2013-12-24 09:31:49 +00:00
|
|
|
if (!mAfterFastTyping || deltaTime >= mRecognitionParams.mDynamicThresholdDecayDuration) {
|
|
|
|
return mRecognitionParams.mDynamicTimeThresholdTo;
|
2012-09-27 10:01:17 +00:00
|
|
|
}
|
|
|
|
final int decayedThreshold =
|
2013-12-24 09:31:49 +00:00
|
|
|
(mRecognitionParams.mDynamicTimeThresholdFrom
|
|
|
|
- mRecognitionParams.mDynamicTimeThresholdTo)
|
|
|
|
* deltaTime / mRecognitionParams.mDynamicThresholdDecayDuration;
|
|
|
|
return mRecognitionParams.mDynamicTimeThresholdFrom - decayedThreshold;
|
2012-09-25 05:23:23 +00:00
|
|
|
}
|
|
|
|
|
2012-10-09 05:31:13 +00:00
|
|
|
public final boolean isStartOfAGesture() {
|
|
|
|
if (!hasDetectedFastMove()) {
|
2012-09-21 03:15:02 +00:00
|
|
|
return false;
|
|
|
|
}
|
2013-01-10 01:34:20 +00:00
|
|
|
final int size = getLength();
|
2012-09-21 03:15:02 +00:00
|
|
|
if (size <= 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
final int lastIndex = size - 1;
|
|
|
|
final int deltaTime = mEventTimes.get(lastIndex) - mDetectFastMoveTime;
|
2012-10-09 05:31:13 +00:00
|
|
|
if (deltaTime < 0) {
|
|
|
|
return false;
|
|
|
|
}
|
2012-09-27 10:01:17 +00:00
|
|
|
final int deltaDistance = getDistance(
|
2012-09-21 03:15:02 +00:00
|
|
|
mXCoordinates.get(lastIndex), mYCoordinates.get(lastIndex),
|
|
|
|
mDetectFastMoveX, mDetectFastMoveY);
|
2012-09-27 10:01:17 +00:00
|
|
|
final int distanceThreshold = getGestureDynamicDistanceThreshold(deltaTime);
|
|
|
|
final int timeThreshold = getGestureDynamicTimeThreshold(deltaTime);
|
|
|
|
final boolean isStartOfAGesture = deltaTime >= timeThreshold
|
|
|
|
&& deltaDistance >= distanceThreshold;
|
2012-09-21 03:15:02 +00:00
|
|
|
if (DEBUG) {
|
2012-09-27 10:01:17 +00:00
|
|
|
Log.d(TAG, String.format("[%d] isStartOfAGesture: dT=%3d tT=%3d dD=%3d tD=%3d%s%s",
|
|
|
|
mPointerId, deltaTime, timeThreshold,
|
|
|
|
deltaDistance, distanceThreshold,
|
|
|
|
mAfterFastTyping ? " afterFastTyping" : "",
|
|
|
|
isStartOfAGesture ? " startOfAGesture" : ""));
|
2012-09-21 03:15:02 +00:00
|
|
|
}
|
|
|
|
return isStartOfAGesture;
|
2012-07-18 05:27:51 +00:00
|
|
|
}
|
|
|
|
|
2012-11-22 02:04:41 +00:00
|
|
|
public void duplicateLastPointWith(final int time) {
|
2013-01-10 01:34:20 +00:00
|
|
|
final int lastIndex = getLength() - 1;
|
2012-11-22 02:04:41 +00:00
|
|
|
if (lastIndex >= 0) {
|
|
|
|
final int x = mXCoordinates.get(lastIndex);
|
|
|
|
final int y = mYCoordinates.get(lastIndex);
|
2013-01-09 03:56:55 +00:00
|
|
|
if (DEBUG) {
|
|
|
|
Log.d(TAG, String.format("[%d] duplicateLastPointWith: %d,%d|%d", mPointerId,
|
|
|
|
x, y, time));
|
|
|
|
}
|
2012-11-22 02:04:41 +00:00
|
|
|
// TODO: Have appendMajorPoint()
|
|
|
|
appendPoint(x, y, time);
|
|
|
|
updateIncrementalRecognitionSize(x, y, time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-24 09:55:47 +00:00
|
|
|
private void reset() {
|
2012-07-19 05:47:55 +00:00
|
|
|
mIncrementalRecognitionSize = 0;
|
2012-07-19 12:53:42 +00:00
|
|
|
mLastIncrementalBatchSize = 0;
|
2012-07-20 07:24:54 +00:00
|
|
|
mEventTimes.setLength(0);
|
|
|
|
mXCoordinates.setLength(0);
|
|
|
|
mYCoordinates.setLength(0);
|
2012-09-21 03:15:02 +00:00
|
|
|
mLastMajorEventTime = 0;
|
|
|
|
mDetectFastMoveTime = 0;
|
2012-09-25 05:23:23 +00:00
|
|
|
mAfterFastTyping = false;
|
2012-09-21 03:15:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void appendPoint(final int x, final int y, final int time) {
|
2013-01-10 01:34:20 +00:00
|
|
|
final int lastIndex = getLength() - 1;
|
2013-01-09 03:56:55 +00:00
|
|
|
// 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.
|
|
|
|
if (lastIndex >= 0 && mEventTimes.get(lastIndex) > time) {
|
|
|
|
Log.w(TAG, String.format("[%d] drop stale event: %d,%d|%d last: %d,%d|%d", mPointerId,
|
|
|
|
x, y, time, mXCoordinates.get(lastIndex), mYCoordinates.get(lastIndex),
|
|
|
|
mEventTimes.get(lastIndex)));
|
|
|
|
return;
|
|
|
|
}
|
2012-09-21 03:15:02 +00:00
|
|
|
mEventTimes.add(time);
|
|
|
|
mXCoordinates.add(x);
|
|
|
|
mYCoordinates.add(y);
|
2012-07-18 05:27:51 +00:00
|
|
|
}
|
|
|
|
|
2012-09-21 03:15:02 +00:00
|
|
|
private void updateMajorEvent(final int x, final int y, final int time) {
|
|
|
|
mLastMajorEventTime = time;
|
|
|
|
mLastMajorEventX = x;
|
|
|
|
mLastMajorEventY = y;
|
|
|
|
}
|
|
|
|
|
2012-10-11 05:19:03 +00:00
|
|
|
private final boolean hasDetectedFastMove() {
|
2012-10-09 05:31:13 +00:00
|
|
|
return mDetectFastMoveTime > 0;
|
|
|
|
}
|
|
|
|
|
2012-09-21 03:15:02 +00:00
|
|
|
private int detectFastMove(final int x, final int y, final int time) {
|
2013-01-10 01:34:20 +00:00
|
|
|
final int size = getLength();
|
2012-09-21 03:15:02 +00:00
|
|
|
final int lastIndex = size - 1;
|
|
|
|
final int lastX = mXCoordinates.get(lastIndex);
|
|
|
|
final int lastY = mYCoordinates.get(lastIndex);
|
|
|
|
final int dist = getDistance(lastX, lastY, x, y);
|
|
|
|
final int msecs = time - mEventTimes.get(lastIndex);
|
|
|
|
if (msecs > 0) {
|
|
|
|
final int pixels = getDistance(lastX, lastY, x, y);
|
|
|
|
final int pixelsPerSec = pixels * MSEC_PER_SEC;
|
2012-09-27 10:01:17 +00:00
|
|
|
if (DEBUG_SPEED) {
|
2012-09-21 03:15:02 +00:00
|
|
|
final float speed = (float)pixelsPerSec / msecs / mKeyWidth;
|
2012-09-27 10:01:17 +00:00
|
|
|
Log.d(TAG, String.format("[%d] detectFastMove: speed=%5.2f", mPointerId, speed));
|
2012-09-21 03:15:02 +00:00
|
|
|
}
|
|
|
|
// Equivalent to (pixels / msecs < mStartSpeedThreshold / MSEC_PER_SEC)
|
2012-10-09 05:31:13 +00:00
|
|
|
if (!hasDetectedFastMove() && pixelsPerSec > mDetectFastMoveSpeedThreshold * msecs) {
|
2012-09-21 03:15:02 +00:00
|
|
|
if (DEBUG) {
|
2012-09-27 10:01:17 +00:00
|
|
|
final float speed = (float)pixelsPerSec / msecs / mKeyWidth;
|
|
|
|
Log.d(TAG, String.format(
|
|
|
|
"[%d] detectFastMove: speed=%5.2f T=%3d points=%3d fastMove",
|
|
|
|
mPointerId, speed, time, size));
|
2012-09-21 03:15:02 +00:00
|
|
|
}
|
|
|
|
mDetectFastMoveTime = time;
|
|
|
|
mDetectFastMoveX = x;
|
|
|
|
mDetectFastMoveY = y;
|
|
|
|
}
|
2012-07-18 05:27:51 +00:00
|
|
|
}
|
2012-09-21 03:15:02 +00:00
|
|
|
return dist;
|
|
|
|
}
|
|
|
|
|
2012-11-22 06:39:28 +00:00
|
|
|
/**
|
|
|
|
* Add a touch event as a gesture point. Returns true if the touch event is on the valid
|
|
|
|
* gesture area.
|
|
|
|
* @param x the x-coordinate of the touch event
|
|
|
|
* @param y the y-coordinate of the touch event
|
|
|
|
* @param time the elapsed time in millisecond from the first gesture down
|
|
|
|
* @param isMajorEvent false if this is a historical move event
|
|
|
|
* @return true if the touch event is on the valid gesture area
|
|
|
|
*/
|
|
|
|
public boolean addPointOnKeyboard(final int x, final int y, final int time,
|
|
|
|
final boolean isMajorEvent) {
|
2013-01-10 01:34:20 +00:00
|
|
|
final int size = getLength();
|
2012-09-21 03:15:02 +00:00
|
|
|
if (size <= 0) {
|
|
|
|
// Down event
|
|
|
|
appendPoint(x, y, time);
|
|
|
|
updateMajorEvent(x, y, time);
|
|
|
|
} else {
|
2012-09-27 10:01:17 +00:00
|
|
|
final int distance = detectFastMove(x, y, time);
|
|
|
|
if (distance > mGestureSamplingMinimumDistance) {
|
2012-09-21 03:15:02 +00:00
|
|
|
appendPoint(x, y, time);
|
|
|
|
}
|
2012-07-18 05:27:51 +00:00
|
|
|
}
|
2012-09-21 03:15:02 +00:00
|
|
|
if (isMajorEvent) {
|
2012-09-20 07:39:40 +00:00
|
|
|
updateIncrementalRecognitionSize(x, y, time);
|
2012-09-21 03:15:02 +00:00
|
|
|
updateMajorEvent(x, y, time);
|
2012-09-20 07:39:40 +00:00
|
|
|
}
|
2012-11-22 06:39:28 +00:00
|
|
|
return y >= mMinYCoordinate && y < mMaxYCoordinate;
|
2012-09-20 07:39:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void updateIncrementalRecognitionSize(final int x, final int y, final int time) {
|
2012-09-21 03:15:02 +00:00
|
|
|
final int msecs = (int)(time - mLastMajorEventTime);
|
|
|
|
if (msecs <= 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
final int pixels = getDistance(mLastMajorEventX, mLastMajorEventY, x, y);
|
|
|
|
final int pixelsPerSec = pixels * MSEC_PER_SEC;
|
|
|
|
// Equivalent to (pixels / msecs < mGestureRecognitionThreshold / MSEC_PER_SEC)
|
|
|
|
if (pixelsPerSec < mGestureRecognitionSpeedThreshold * msecs) {
|
2013-01-10 01:34:20 +00:00
|
|
|
mIncrementalRecognitionSize = getLength();
|
2012-07-18 05:27:51 +00:00
|
|
|
}
|
2012-09-27 10:01:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 03:12:54 +00:00
|
|
|
public final boolean hasRecognitionTimePast(
|
2012-09-27 10:01:17 +00:00
|
|
|
final long currentTime, final long lastRecognitionTime) {
|
2013-12-24 09:31:49 +00:00
|
|
|
return currentTime > lastRecognitionTime + mRecognitionParams.mRecognitionMinimumTime;
|
2012-07-18 05:27:51 +00:00
|
|
|
}
|
|
|
|
|
2012-10-09 05:31:13 +00:00
|
|
|
public final void appendAllBatchPoints(final InputPointers out) {
|
2013-01-10 01:34:20 +00:00
|
|
|
appendBatchPoints(out, getLength());
|
2012-07-18 05:27:51 +00:00
|
|
|
}
|
|
|
|
|
2012-10-09 05:31:13 +00:00
|
|
|
public final void appendIncrementalBatchPoints(final InputPointers out) {
|
2012-07-20 07:24:54 +00:00
|
|
|
appendBatchPoints(out, mIncrementalRecognitionSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void appendBatchPoints(final InputPointers out, final int size) {
|
2012-08-23 06:01:46 +00:00
|
|
|
final int length = size - mLastIncrementalBatchSize;
|
|
|
|
if (length <= 0) {
|
|
|
|
return;
|
|
|
|
}
|
2012-07-20 07:24:54 +00:00
|
|
|
out.append(mPointerId, mEventTimes, mXCoordinates, mYCoordinates,
|
2012-08-23 06:01:46 +00:00
|
|
|
mLastIncrementalBatchSize, length);
|
2012-07-20 07:24:54 +00:00
|
|
|
mLastIncrementalBatchSize = size;
|
2012-07-18 05:27:51 +00:00
|
|
|
}
|
|
|
|
|
2012-09-21 03:15:02 +00:00
|
|
|
private static int getDistance(final int x1, final int y1, final int x2, final int y2) {
|
2013-12-24 09:31:49 +00:00
|
|
|
return (int)Math.hypot(x1 - x2, y1 - y2);
|
2012-07-18 05:27:51 +00:00
|
|
|
}
|
|
|
|
}
|