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

* commit 'e81c16788712590fd6cf9e14420d50acf029ad48':
  Typing double letters via a 'circle' on the key.
main
Keisuke Kuroynagi 2013-04-17 19:38:38 -07:00 committed by Android Git Automerger
commit 5c7c36e31f
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); this("", 1, 1, 1, 1, 1, 1, EMPTY_KEY_ARRAY, null);
mNativeProximityInfo = setProximityInfoNative("" /* locale */, mNativeProximityInfo = setProximityInfoNative("" /* locale */,
gridWidth /* displayWidth */, gridHeight /* displayHeight */, gridWidth /* displayWidth */, gridHeight /* displayHeight */,
gridWidth, gridHeight, 1 /* mostCommonKeyWidth */, proximityCharsArray, gridWidth, gridHeight, 1 /* mostCommonKeyWidth */,
0 /* keyCount */, null /*keyXCoordinates */, null /* keyYCoordinates */, 1 /* mostCommonKeyHeight */, proximityCharsArray, 0 /* keyCount */,
null /*keyXCoordinates */, null /* keyYCoordinates */,
null /* keyWidths */, null /* keyHeights */, null /* keyCharCodes */, null /* keyWidths */, null /* keyHeights */, null /* keyCharCodes */,
null /* sweetSpotCenterXs */, null /* sweetSpotCenterYs */, null /* sweetSpotCenterXs */, null /* sweetSpotCenterYs */,
null /* sweetSpotRadii */); null /* sweetSpotRadii */);
@ -103,9 +104,10 @@ public class ProximityInfo {
// TODO: Stop passing proximityCharsArray // TODO: Stop passing proximityCharsArray
private static native long setProximityInfoNative(String locale, private static native long setProximityInfoNative(String locale,
int displayWidth, int displayHeight, int gridWidth, int gridHeight, int displayWidth, int displayHeight, int gridWidth, int gridHeight,
int mostCommonKeyWidth, int[] proximityCharsArray, int keyCount, int[] keyXCoordinates, int mostCommonKeyWidth, int mostCommonKeyHeight, int[] proximityCharsArray,
int[] keyYCoordinates, int[] keyWidths, int[] keyHeights, int[] keyCharCodes, int keyCount, int[] keyXCoordinates, int[] keyYCoordinates, int[] keyWidths,
float[] sweetSpotCenterXs, float[] sweetSpotCenterYs, float[] sweetSpotRadii); int[] keyHeights, int[] keyCharCodes, float[] sweetSpotCenterXs,
float[] sweetSpotCenterYs, float[] sweetSpotRadii);
private static native void releaseProximityInfoNative(long nativeProximityInfo); private static native void releaseProximityInfoNative(long nativeProximityInfo);
@ -232,9 +234,9 @@ public class ProximityInfo {
// TODO: Stop passing proximityCharsArray // TODO: Stop passing proximityCharsArray
return setProximityInfoNative(mLocaleStr, mKeyboardMinWidth, mKeyboardHeight, return setProximityInfoNative(mLocaleStr, mKeyboardMinWidth, mKeyboardHeight,
mGridWidth, mGridHeight, mMostCommonKeyWidth, proximityCharsArray, keyCount, mGridWidth, mGridHeight, mMostCommonKeyWidth, mMostCommonKeyHeight,
keyXCoordinates, keyYCoordinates, keyWidths, keyHeights, keyCharCodes, proximityCharsArray, keyCount, keyXCoordinates, keyYCoordinates, keyWidths,
sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii); keyHeights, keyCharCodes, sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii);
} }
public long getNativeProximityInfo() { public long getNativeProximityInfo() {

View File

@ -26,13 +26,13 @@ namespace latinime {
static jlong latinime_Keyboard_setProximityInfo(JNIEnv *env, jclass clazz, jstring localeJStr, static jlong latinime_Keyboard_setProximityInfo(JNIEnv *env, jclass clazz, jstring localeJStr,
jint displayWidth, jint displayHeight, jint gridWidth, jint gridHeight, 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 keyXCoordinates, jintArray keyYCoordinates, jintArray keyWidths,
jintArray keyHeights, jintArray keyCharCodes, jfloatArray sweetSpotCenterXs, jintArray keyHeights, jintArray keyCharCodes, jfloatArray sweetSpotCenterXs,
jfloatArray sweetSpotCenterYs, jfloatArray sweetSpotRadii) { jfloatArray sweetSpotCenterYs, jfloatArray sweetSpotRadii) {
ProximityInfo *proximityInfo = new ProximityInfo(env, localeJStr, displayWidth, displayHeight, ProximityInfo *proximityInfo = new ProximityInfo(env, localeJStr, displayWidth, displayHeight,
gridWidth, gridHeight, mostCommonkeyWidth, proximityChars, keyCount, gridWidth, gridHeight, mostCommonkeyWidth, mostCommonkeyHeight, proximityChars,
keyXCoordinates, keyYCoordinates, keyWidths, keyHeights, keyCharCodes, keyCount, keyXCoordinates, keyYCoordinates, keyWidths, keyHeights, keyCharCodes,
sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii); sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii);
return reinterpret_cast<jlong>(proximityInfo); return reinterpret_cast<jlong>(proximityInfo);
} }
@ -44,7 +44,7 @@ static void latinime_Keyboard_release(JNIEnv *env, jclass clazz, jlong proximity
static JNINativeMethod sMethods[] = { static JNINativeMethod sMethods[] = {
{const_cast<char *>("setProximityInfoNative"), {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)}, reinterpret_cast<void *>(latinime_Keyboard_setProximityInfo)},
{const_cast<char *>("releaseProximityInfoNative"), {const_cast<char *>("releaseProximityInfoNative"),
const_cast<char *>("(J)V"), 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, ProximityInfo::ProximityInfo(JNIEnv *env, const jstring localeJStr,
const int keyboardWidth, const int keyboardHeight, const int gridWidth, const int keyboardWidth, const int keyboardHeight, const int gridWidth,
const int gridHeight, const int mostCommonKeyWidth, const jintArray proximityChars, const int gridHeight, const int mostCommonKeyWidth, const int mostCommonKeyHeight,
const int keyCount, const jintArray keyXCoordinates, const jintArray keyYCoordinates, const jintArray proximityChars, const int keyCount, const jintArray keyXCoordinates,
const jintArray keyWidths, const jintArray keyHeights, const jintArray keyCharCodes, const jintArray keyYCoordinates, const jintArray keyWidths, const jintArray keyHeights,
const jfloatArray sweetSpotCenterXs, const jfloatArray sweetSpotCenterYs, const jintArray keyCharCodes, const jfloatArray sweetSpotCenterXs,
const jfloatArray sweetSpotRadii) const jfloatArray sweetSpotCenterYs, const jfloatArray sweetSpotRadii)
: GRID_WIDTH(gridWidth), GRID_HEIGHT(gridHeight), MOST_COMMON_KEY_WIDTH(mostCommonKeyWidth), : GRID_WIDTH(gridWidth), GRID_HEIGHT(gridHeight), MOST_COMMON_KEY_WIDTH(mostCommonKeyWidth),
MOST_COMMON_KEY_WIDTH_SQUARE(mostCommonKeyWidth * 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_WIDTH((keyboardWidth + gridWidth - 1) / gridWidth),
CELL_HEIGHT((keyboardHeight + gridHeight - 1) / gridHeight), CELL_HEIGHT((keyboardHeight + gridHeight - 1) / gridHeight),
KEY_COUNT(min(keyCount, MAX_KEY_COUNT_IN_A_KEYBOARD)), KEY_COUNT(min(keyCount, MAX_KEY_COUNT_IN_A_KEYBOARD)),

View File

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