diff options
author | 2012-03-05 14:27:49 +0900 | |
---|---|---|
committer | 2012-03-05 14:27:49 +0900 | |
commit | 895b70b8afd3ba21850ff905e9c1dc2a40fcd061 (patch) | |
tree | 515a4d115688cab0ccc19b01ad29104a65423bfb /java/src | |
parent | 9b01890254c62a30b079bd9f79a30f9541faf11b (diff) | |
download | latinime-895b70b8afd3ba21850ff905e9c1dc2a40fcd061.tar.gz latinime-895b70b8afd3ba21850ff905e9c1dc2a40fcd061.tar.xz latinime-895b70b8afd3ba21850ff905e9c1dc2a40fcd061.zip |
Move some treatment to a more sensical place.
It makes more sense to catch words with the safety net in
updateSuggestions() than in showSuggestions(). Also, it's useless
to do it in updateBigramPredictions, because the result will
always be provably false.
This will also help with writing unit tests.
Change-Id: Ifab81e6c5a74b1aa75cf85ef7742fee69a98f5ce
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index f92949681..59fa66ded 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1827,18 +1827,18 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar builder.addTypedWordAndPreviousSuggestions(typedWord, previousSuggestions); } } + final SuggestedWords suggestedWords = builder.build(); + if (Utils.shouldBlockAutoCorrectionBySafetyNet(suggestedWords, mSuggest)) { + suggestedWords.setShouldBlockAutoCorrectionBySatefyNet(); + } showSuggestions(builder.build(), typedWord); } public void showSuggestions(final SuggestedWords suggestedWords, final CharSequence typedWord) { - final boolean shouldBlockAutoCorrectionBySafetyNet = - Utils.shouldBlockAutoCorrectionBySafetyNet(suggestedWords, mSuggest); - if (shouldBlockAutoCorrectionBySafetyNet) { - suggestedWords.setShouldBlockAutoCorrectionBySatefyNet(); - } final CharSequence autoCorrection; if (suggestedWords.size() > 0) { - if (!shouldBlockAutoCorrectionBySafetyNet && suggestedWords.hasAutoCorrectionWord()) { + if (!suggestedWords.shouldBlockAutoCorrectionBySafetyNet() + && suggestedWords.hasAutoCorrectionWord()) { autoCorrection = suggestedWords.getWord(1); } else { autoCorrection = typedWord; |