diff options
author | 2014-03-27 08:41:25 +0000 | |
---|---|---|
committer | 2014-03-27 08:41:25 +0000 | |
commit | e769c13af4393a335ce9d91e2c9b11631a523149 (patch) | |
tree | ee1a7bcb1450694ea29a2d78fffa05b558c62d82 /java/src/com/android/inputmethod/latin/BinaryDictionary.java | |
parent | 83ef574f5660dc487a66d213387a40d02f584e4f (diff) | |
parent | 5feda45a6fd89e95b07b0ff1cc9dcaf7de029da1 (diff) | |
download | latinime-e769c13af4393a335ce9d91e2c9b11631a523149.tar.gz latinime-e769c13af4393a335ce9d91e2c9b11631a523149.tar.xz latinime-e769c13af4393a335ce9d91e2c9b11631a523149.zip |
am 5feda45a: Merge "[CB15] Remove a redundant variable."
* commit '5feda45a6fd89e95b07b0ff1cc9dcaf7de029da1':
[CB15] Remove a redundant variable.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/BinaryDictionary.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index 0aa34e82e..323d0c8a3 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -249,8 +249,18 @@ public final class BinaryDictionary extends Dictionary { final boolean isGesture = composer.isBatchMode(); if (composerSize <= 1 || !isGesture) { if (composerSize > MAX_WORD_LENGTH - 1) return null; - for (int i = 0; i < composerSize; i++) { - mInputCodePoints[i] = composer.getCodeAt(i); + final CharSequence typedWord = composer.getTypedWord(); + final int charCount = typedWord.length(); + int typedWordCharIndex = 0; + int inputCodePointIndex = 0; + while (typedWordCharIndex < charCount) { + final int codePoint = Character.codePointAt(typedWord, typedWordCharIndex); + mInputCodePoints[inputCodePointIndex] = codePoint; + typedWordCharIndex += Character.charCount(codePoint); + inputCodePointIndex += 1; + if (inputCodePointIndex >= MAX_WORD_LENGTH) { + break; + } } } |