am 87fdde6e: Typing double letters via a \'circle\' on the key.

* commit '87fdde6ec48844ddbb482c50fbda226c63ca5e85':
  Typing double letters via a 'circle' on the key.
This commit is contained in:
Keisuke Kuroynagi 2013-04-09 20:57:28 -07:00 committed by Android Git Automerger
commit e81c167887
4 changed files with 33 additions and 22 deletions

View File

@ -88,8 +88,9 @@ public class ProximityInfo {
this("", 1, 1, 1, 1, 1, 1, EMPTY_KEY_ARRAY, null);
mNativeProximityInfo = setProximityInfoNative("" /* locale */,
gridWidth /* displayWidth */, gridHeight /* displayHeight */,
gridWidth, gridHeight, 1 /* mostCommonKeyWidth */, proximityCharsArray,
0 /* keyCount */, null /*keyXCoordinates */, null /* keyYCoordinates */,
gridWidth, gridHeight, 1 /* mostCommonKeyWidth */,
1 /* mostCommonKeyHeight */, proximityCharsArray, 0 /* keyCount */,
null /*keyXCoordinates */, null /* keyYCoordinates */,
null /* keyWidths */, null /* keyHeights */, null /* keyCharCodes */,
null /* sweetSpotCenterXs */, null /* sweetSpotCenterYs */,
null /* sweetSpotRadii */);
@ -103,9 +104,10 @@ public class ProximityInfo {
// TODO: Stop passing proximityCharsArray
private static native long setProximityInfoNative(String locale,
int displayWidth, int displayHeight, int gridWidth, int gridHeight,
int mostCommonKeyWidth, int[] proximityCharsArray, int keyCount, int[] keyXCoordinates,
int[] keyYCoordinates, int[] keyWidths, int[] keyHeights, int[] keyCharCodes,
float[] sweetSpotCenterXs, float[] sweetSpotCenterYs, float[] sweetSpotRadii);
int mostCommonKeyWidth, int mostCommonKeyHeight, int[] proximityCharsArray,
int keyCount, int[] keyXCoordinates, int[] keyYCoordinates, int[] keyWidths,
int[] keyHeights, int[] keyCharCodes, float[] sweetSpotCenterXs,
float[] sweetSpotCenterYs, float[] sweetSpotRadii);
private static native void releaseProximityInfoNative(long nativeProximityInfo);
@ -232,9 +234,9 @@ public class ProximityInfo {
// TODO: Stop passing proximityCharsArray
return setProximityInfoNative(mLocaleStr, mKeyboardMinWidth, mKeyboardHeight,
mGridWidth, mGridHeight, mMostCommonKeyWidth, proximityCharsArray, keyCount,
keyXCoordinates, keyYCoordinates, keyWidths, keyHeights, keyCharCodes,
sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii);
mGridWidth, mGridHeight, mMostCommonKeyWidth, mMostCommonKeyHeight,
proximityCharsArray, keyCount, keyXCoordinates, keyYCoordinates, keyWidths,
keyHeights, keyCharCodes, sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii);
}
public long getNativeProximityInfo() {

View File

@ -26,13 +26,13 @@ namespace latinime {
static jlong latinime_Keyboard_setProximityInfo(JNIEnv *env, jclass clazz, jstring localeJStr,
jint displayWidth, jint displayHeight, jint gridWidth, jint gridHeight,
jint mostCommonkeyWidth, jintArray proximityChars, jint keyCount,
jint mostCommonkeyWidth, jint mostCommonkeyHeight, jintArray proximityChars, jint keyCount,
jintArray keyXCoordinates, jintArray keyYCoordinates, jintArray keyWidths,
jintArray keyHeights, jintArray keyCharCodes, jfloatArray sweetSpotCenterXs,
jfloatArray sweetSpotCenterYs, jfloatArray sweetSpotRadii) {
ProximityInfo *proximityInfo = new ProximityInfo(env, localeJStr, displayWidth, displayHeight,
gridWidth, gridHeight, mostCommonkeyWidth, proximityChars, keyCount,
keyXCoordinates, keyYCoordinates, keyWidths, keyHeights, keyCharCodes,
gridWidth, gridHeight, mostCommonkeyWidth, mostCommonkeyHeight, proximityChars,
keyCount, keyXCoordinates, keyYCoordinates, keyWidths, keyHeights, keyCharCodes,
sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii);
return reinterpret_cast<jlong>(proximityInfo);
}
@ -44,7 +44,7 @@ static void latinime_Keyboard_release(JNIEnv *env, jclass clazz, jlong proximity
static JNINativeMethod sMethods[] = {
{const_cast<char *>("setProximityInfoNative"),
const_cast<char *>("(Ljava/lang/String;IIIII[II[I[I[I[I[I[F[F[F)J"),
const_cast<char *>("(Ljava/lang/String;IIIIII[II[I[I[I[I[I[F[F[F)J"),
reinterpret_cast<void *>(latinime_Keyboard_setProximityInfo)},
{const_cast<char *>("releaseProximityInfoNative"),
const_cast<char *>("(J)V"),

View File

@ -49,13 +49,17 @@ static AK_FORCE_INLINE void safeGetOrFillZeroFloatArrayRegion(JNIEnv *env, jfloa
ProximityInfo::ProximityInfo(JNIEnv *env, const jstring localeJStr,
const int keyboardWidth, const int keyboardHeight, const int gridWidth,
const int gridHeight, const int mostCommonKeyWidth, const jintArray proximityChars,
const int keyCount, const jintArray keyXCoordinates, const jintArray keyYCoordinates,
const jintArray keyWidths, const jintArray keyHeights, const jintArray keyCharCodes,
const jfloatArray sweetSpotCenterXs, const jfloatArray sweetSpotCenterYs,
const jfloatArray sweetSpotRadii)
const int gridHeight, const int mostCommonKeyWidth, const int mostCommonKeyHeight,
const jintArray proximityChars, const int keyCount, const jintArray keyXCoordinates,
const jintArray keyYCoordinates, const jintArray keyWidths, const jintArray keyHeights,
const jintArray keyCharCodes, const jfloatArray sweetSpotCenterXs,
const jfloatArray sweetSpotCenterYs, const jfloatArray sweetSpotRadii)
: GRID_WIDTH(gridWidth), GRID_HEIGHT(gridHeight), MOST_COMMON_KEY_WIDTH(mostCommonKeyWidth),
MOST_COMMON_KEY_WIDTH_SQUARE(mostCommonKeyWidth * mostCommonKeyWidth),
MOST_COMMON_KEY_HEIGHT(mostCommonKeyHeight),
NORMALIZED_SQUARED_MOST_COMMON_KEY_HYPOTENUSE(1.0f +
SQUARE_FLOAT(static_cast<float>(mostCommonKeyHeight) /
static_cast<float>(mostCommonKeyWidth))),
CELL_WIDTH((keyboardWidth + gridWidth - 1) / gridWidth),
CELL_HEIGHT((keyboardHeight + gridHeight - 1) / gridHeight),
KEY_COUNT(min(keyCount, MAX_KEY_COUNT_IN_A_KEYBOARD)),

View File

@ -30,11 +30,11 @@ class ProximityInfo {
public:
ProximityInfo(JNIEnv *env, const jstring localeJStr,
const int keyboardWidth, const int keyboardHeight, const int gridWidth,
const int gridHeight, const int mostCommonKeyWidth, const jintArray proximityChars,
const int keyCount, const jintArray keyXCoordinates, const jintArray keyYCoordinates,
const jintArray keyWidths, const jintArray keyHeights, const jintArray keyCharCodes,
const jfloatArray sweetSpotCenterXs, const jfloatArray sweetSpotCenterYs,
const jfloatArray sweetSpotRadii);
const int gridHeight, const int mostCommonKeyWidth, const int mostCommonKeyHeight,
const jintArray proximityChars, const int keyCount, const jintArray keyXCoordinates,
const jintArray keyYCoordinates, const jintArray keyWidths, const jintArray keyHeights,
const jintArray keyCharCodes, const jfloatArray sweetSpotCenterXs,
const jfloatArray sweetSpotCenterYs, const jfloatArray sweetSpotRadii);
~ProximityInfo();
bool hasSpaceProximity(const int x, const int y) const;
int getNormalizedSquaredDistance(const int inputIndex, const int proximityIndex) const;
@ -56,6 +56,9 @@ class ProximityInfo {
bool hasTouchPositionCorrectionData() const { return HAS_TOUCH_POSITION_CORRECTION_DATA; }
int getMostCommonKeyWidth() const { return MOST_COMMON_KEY_WIDTH; }
int getMostCommonKeyWidthSquare() const { return MOST_COMMON_KEY_WIDTH_SQUARE; }
float getNormalizedSquaredMostCommonKeyHypotenuse() const {
return NORMALIZED_SQUARED_MOST_COMMON_KEY_HYPOTENUSE;
}
int getKeyCount() const { return KEY_COUNT; }
int getCellHeight() const { return CELL_HEIGHT; }
int getCellWidth() const { return CELL_WIDTH; }
@ -99,6 +102,8 @@ class ProximityInfo {
const int GRID_HEIGHT;
const int MOST_COMMON_KEY_WIDTH;
const int MOST_COMMON_KEY_WIDTH_SQUARE;
const int MOST_COMMON_KEY_HEIGHT;
const float NORMALIZED_SQUARED_MOST_COMMON_KEY_HYPOTENUSE;
const int CELL_WIDTH;
const int CELL_HEIGHT;
const int KEY_COUNT;