diff options
author | 2012-07-10 20:50:52 +0900 | |
---|---|---|
committer | 2012-07-11 16:14:58 +0900 | |
commit | e4e7e5fc82eca67330765510ad0bd29caeb7a1bb (patch) | |
tree | 9cbcb3da548fd33ea0938669eaa7f6b40711b93a /java/src/com/android/inputmethod/latin/BinaryDictionary.java | |
parent | 5e21ea1a3553000529c288acdf6d6a4b165bedc5 (diff) | |
download | latinime-e4e7e5fc82eca67330765510ad0bd29caeb7a1bb.tar.gz latinime-e4e7e5fc82eca67330765510ad0bd29caeb7a1bb.tar.xz latinime-e4e7e5fc82eca67330765510ad0bd29caeb7a1bb.zip |
Cleanup (A103)
Change-Id: Ib5ebddfdb87ef71a2f8d859fb45d3ac78040e97a
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/BinaryDictionary.java | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index 255ef3ad1..20c1b25db 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -116,7 +116,8 @@ public class BinaryDictionary extends Dictionary { ? null : StringUtils.toCodePointArray(prevWord.toString()); final int composerSize = composer.size(); - if (composerSize <= 1 || !composer.isBatchMode()) { + final boolean isGesture = composer.isBatchMode(); + if (composerSize <= 1 || !isGesture) { if (composerSize > MAX_WORD_LENGTH - 1) return null; for (int i = 0; i < composerSize; i++) { mInputCodes[i] = composer.getCodeAt(i); @@ -124,7 +125,7 @@ public class BinaryDictionary extends Dictionary { } final int count; - if (!composer.isBatchMode() && composer.size() <= 1) { + if (!isGesture && composerSize <= 1) { if (TextUtils.isEmpty(prevWord)) return null; int tmpCount = getBigramsNative(mNativeDict, prevWordCodePointArray, prevWordCodePointArray.length, mInputCodes, composerSize, @@ -132,23 +133,17 @@ public class BinaryDictionary extends Dictionary { count = Math.min(tmpCount, MAX_BIGRAMS); } else { final InputPointers ips = composer.getInputPointers(); - final boolean isGesture = composer.isBatchMode(); - final int codesSize; - if (isGesture) { - codesSize = ips.getPointerSize(); - } else { - codesSize = composer.size(); - } - + final int codesSize = isGesture ? ips.getPointerSize() : composerSize; // proximityInfo and/or prevWordForBigrams may not be null. count = getSuggestionsNative(mNativeDict, proximityInfo.getNativeProximityInfo(), ips.getXCoordinates(), ips.getYCoordinates(), ips.getTimes(), ips.getPointerIds(), mInputCodes, codesSize, 0 /* unused */, isGesture, prevWordCodePointArray, mUseFullEditDistance, mOutputChars, mOutputScores, mSpaceIndices); } + final ArrayList<SuggestedWordInfo> suggestions = new ArrayList<SuggestedWordInfo>(); for (int j = 0; j < count; ++j) { - if (composer.size() > 0 && mOutputScores[j] < 1) break; + if (composerSize > 0 && mOutputScores[j] < 1) break; final int start = j * MAX_WORD_LENGTH; int len = 0; while (len < MAX_WORD_LENGTH && mOutputChars[start + len] != 0) { |