diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/res/drawable-mdpi/keyboard_hint_0.9.png | bin | 379 -> 307 bytes | |||
-rw-r--r-- | java/res/drawable-mdpi/keyboard_hint_1.9.png | bin | 301 -> 302 bytes | |||
-rw-r--r-- | java/res/drawable-mdpi/keyboard_hint_2.9.png | bin | 404 -> 334 bytes | |||
-rw-r--r-- | java/res/drawable-mdpi/keyboard_hint_3.9.png | bin | 413 -> 327 bytes | |||
-rw-r--r-- | java/res/drawable-mdpi/keyboard_hint_4.9.png | bin | 341 -> 329 bytes | |||
-rw-r--r-- | java/res/drawable-mdpi/keyboard_hint_5.9.png | bin | 388 -> 334 bytes | |||
-rw-r--r-- | java/res/drawable-mdpi/keyboard_hint_6.9.png | bin | 413 -> 329 bytes | |||
-rw-r--r-- | java/res/drawable-mdpi/keyboard_hint_7.9.png | bin | 367 -> 334 bytes | |||
-rw-r--r-- | java/res/drawable-mdpi/keyboard_hint_8.9.png | bin | 417 -> 332 bytes | |||
-rw-r--r-- | java/res/drawable-mdpi/keyboard_hint_9.9.png | bin | 417 -> 339 bytes | |||
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 4 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIMEUtil.java | 88 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinImeLogger.java | 2 |
13 files changed, 92 insertions, 2 deletions
diff --git a/java/res/drawable-mdpi/keyboard_hint_0.9.png b/java/res/drawable-mdpi/keyboard_hint_0.9.png Binary files differindex 271264e92..61ad1b50a 100644 --- a/java/res/drawable-mdpi/keyboard_hint_0.9.png +++ b/java/res/drawable-mdpi/keyboard_hint_0.9.png diff --git a/java/res/drawable-mdpi/keyboard_hint_1.9.png b/java/res/drawable-mdpi/keyboard_hint_1.9.png Binary files differindex eaf374262..cd7772e71 100644 --- a/java/res/drawable-mdpi/keyboard_hint_1.9.png +++ b/java/res/drawable-mdpi/keyboard_hint_1.9.png diff --git a/java/res/drawable-mdpi/keyboard_hint_2.9.png b/java/res/drawable-mdpi/keyboard_hint_2.9.png Binary files differindex 8a1657117..fa5f8b79c 100644 --- a/java/res/drawable-mdpi/keyboard_hint_2.9.png +++ b/java/res/drawable-mdpi/keyboard_hint_2.9.png diff --git a/java/res/drawable-mdpi/keyboard_hint_3.9.png b/java/res/drawable-mdpi/keyboard_hint_3.9.png Binary files differindex 34b501109..0c7336cb7 100644 --- a/java/res/drawable-mdpi/keyboard_hint_3.9.png +++ b/java/res/drawable-mdpi/keyboard_hint_3.9.png diff --git a/java/res/drawable-mdpi/keyboard_hint_4.9.png b/java/res/drawable-mdpi/keyboard_hint_4.9.png Binary files differindex d4cc250dd..73ef06c0e 100644 --- a/java/res/drawable-mdpi/keyboard_hint_4.9.png +++ b/java/res/drawable-mdpi/keyboard_hint_4.9.png diff --git a/java/res/drawable-mdpi/keyboard_hint_5.9.png b/java/res/drawable-mdpi/keyboard_hint_5.9.png Binary files differindex 6a054b42f..aea460e1c 100644 --- a/java/res/drawable-mdpi/keyboard_hint_5.9.png +++ b/java/res/drawable-mdpi/keyboard_hint_5.9.png diff --git a/java/res/drawable-mdpi/keyboard_hint_6.9.png b/java/res/drawable-mdpi/keyboard_hint_6.9.png Binary files differindex 66e91400a..16a9237e3 100644 --- a/java/res/drawable-mdpi/keyboard_hint_6.9.png +++ b/java/res/drawable-mdpi/keyboard_hint_6.9.png diff --git a/java/res/drawable-mdpi/keyboard_hint_7.9.png b/java/res/drawable-mdpi/keyboard_hint_7.9.png Binary files differindex 5eae24f4f..6747a19c0 100644 --- a/java/res/drawable-mdpi/keyboard_hint_7.9.png +++ b/java/res/drawable-mdpi/keyboard_hint_7.9.png diff --git a/java/res/drawable-mdpi/keyboard_hint_8.9.png b/java/res/drawable-mdpi/keyboard_hint_8.9.png Binary files differindex ea7f512fd..28be2fb86 100644 --- a/java/res/drawable-mdpi/keyboard_hint_8.9.png +++ b/java/res/drawable-mdpi/keyboard_hint_8.9.png diff --git a/java/res/drawable-mdpi/keyboard_hint_9.9.png b/java/res/drawable-mdpi/keyboard_hint_9.9.png Binary files differindex 0bf85de93..731d63b1b 100644 --- a/java/res/drawable-mdpi/keyboard_hint_9.9.png +++ b/java/res/drawable-mdpi/keyboard_hint_9.9.png diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 2c0b80961..696f530d3 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -16,6 +16,7 @@ package com.android.inputmethod.latin; +import com.android.inputmethod.latin.LatinIMEUtil.RingCharBuffer; import com.android.inputmethod.voice.FieldContext; import com.android.inputmethod.voice.SettingsUtil; import com.android.inputmethod.voice.VoiceInput; @@ -1197,7 +1198,8 @@ public class LatinIME extends InputMethodService if (primaryCode != KEYCODE_ENTER) { mJustAddedAutoSpace = false; } - LatinImeLogger.logOnInputChar((char)primaryCode, x, y); + RingCharBuffer.getInstance().push((char)primaryCode, x, y); + LatinImeLogger.logOnInputChar(); if (isWordSeparator(primaryCode)) { handleSeparator(primaryCode); } else { diff --git a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java b/java/src/com/android/inputmethod/latin/LatinIMEUtil.java index 34b52845e..85ecaee50 100644 --- a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java +++ b/java/src/com/android/inputmethod/latin/LatinIMEUtil.java @@ -80,4 +80,92 @@ public class LatinIMEUtil { return ((InputMethodManager) context.getSystemService( Context.INPUT_METHOD_SERVICE)).getEnabledInputMethodList().size() > 1; } + + /* package */ static class RingCharBuffer { + private static RingCharBuffer sRingCharBuffer = new RingCharBuffer(); + private static final char PLACEHOLDER_DELIMITER_CHAR = '\uFFFC'; + private static final int INVALID_COORDINATE = -2; + /* package */ static final int BUFSIZE = 20; + private Context mContext; + private boolean mEnabled = false; + private int mEnd = 0; + /* package */ int mLength = 0; + private char[] mCharBuf = new char[BUFSIZE]; + private int[] mXBuf = new int[BUFSIZE]; + private int[] mYBuf = new int[BUFSIZE]; + + private RingCharBuffer() { + } + public static RingCharBuffer getInstance() { + return sRingCharBuffer; + } + public static RingCharBuffer init(Context context, boolean enabled) { + sRingCharBuffer.mContext = context; + sRingCharBuffer.mEnabled = enabled; + return sRingCharBuffer; + } + private int normalize(int in) { + int ret = in % BUFSIZE; + return ret < 0 ? ret + BUFSIZE : ret; + } + public void push(char c, int x, int y) { + if (!mEnabled) return; + mCharBuf[mEnd] = c; + mXBuf[mEnd] = x; + mYBuf[mEnd] = y; + mEnd = normalize(mEnd + 1); + if (mLength < BUFSIZE) { + ++mLength; + } + } + public char pop() { + if (mLength < 1) { + return PLACEHOLDER_DELIMITER_CHAR; + } else { + mEnd = normalize(mEnd - 1); + --mLength; + return mCharBuf[mEnd]; + } + } + public char getLastChar() { + if (mLength < 1) { + return PLACEHOLDER_DELIMITER_CHAR; + } else { + return mCharBuf[normalize(mEnd - 1)]; + } + } + public int getPreviousX(char c, int back) { + int index = normalize(mEnd - 2 - back); + if (mLength <= back + || Character.toLowerCase(c) != Character.toLowerCase(mCharBuf[index])) { + return INVALID_COORDINATE; + } else { + return mXBuf[index]; + } + } + public int getPreviousY(char c, int back) { + int index = normalize(mEnd - 2 - back); + if (mLength <= back + || Character.toLowerCase(c) != Character.toLowerCase(mCharBuf[index])) { + return INVALID_COORDINATE; + } else { + return mYBuf[index]; + } + } + public String getLastString() { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < mLength; ++i) { + char c = mCharBuf[normalize(mEnd - 1 - i)]; + if (!((LatinIME)mContext).isWordSeparator(c)) { + sb.append(c); + } else { + break; + } + } + return sb.reverse().toString(); + } + public void reset() { + mLength = 0; + } + } } diff --git a/java/src/com/android/inputmethod/latin/LatinImeLogger.java b/java/src/com/android/inputmethod/latin/LatinImeLogger.java index 007d0ccdd..6d15d216c 100644 --- a/java/src/com/android/inputmethod/latin/LatinImeLogger.java +++ b/java/src/com/android/inputmethod/latin/LatinImeLogger.java @@ -50,7 +50,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang public static void logOnDelete() { } - public static void logOnInputChar(char c, int x, int y) { + public static void logOnInputChar() { } public static void logOnException(String metaData, Throwable e) { |