aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-07-11 18:49:44 +0900
committerJean Chalard <jchalard@google.com>2012-07-12 15:58:16 +0900
commit2c5cf744e554cbe0872f1b3e18cbd1383b0189f9 (patch)
tree6421527cd4f45281a29e47b4ca99c3203a66f2c3 /java/src
parent1343d27de30c4010c54576d6c8bbb052c7630cbe (diff)
downloadlatinime-2c5cf744e554cbe0872f1b3e18cbd1383b0189f9.tar.gz
latinime-2c5cf744e554cbe0872f1b3e18cbd1383b0189f9.tar.xz
latinime-2c5cf744e554cbe0872f1b3e18cbd1383b0189f9.zip
Increase encapsulation (A118)
showSuggestions is only ever called by updateSuggestionsOrPredictions. It only feels natural that, when called with a 0-sized or null suggestion list, it clears the suggestions. Change-Id: I5b52bc9151afca1bb6c6f0a7f81e3255add92177
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java12
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 3014e7f2b..f27d32150 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1668,6 +1668,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
+ // TODO: rename this method to updateSuggestionStrip or simply updateSuggestions
private void updateSuggestionsOrPredictions() {
mHandler.cancelUpdateSuggestionStrip();
@@ -1699,11 +1700,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mCurrentSettings.mCorrectionEnabled);
suggestedWords = maybeRetrieveOlderSuggestions(typedWord, suggestedWords);
- if (null != suggestedWords && suggestedWords.size() > 0) {
- showSuggestions(suggestedWords, typedWord);
- } else {
- clearSuggestions();
- }
+ showSuggestions(suggestedWords, typedWord);
}
private SuggestedWords maybeRetrieveOlderSuggestions(final CharSequence typedWord,
@@ -1738,7 +1735,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void showSuggestions(final SuggestedWords suggestedWords,
final CharSequence typedWord) {
- // This method is only ever called by updateSuggestions or updateBigramPredictions.
+ if (null == suggestedWords || suggestedWords.size() <= 0) {
+ clearSuggestions();
+ return;
+ }
final CharSequence autoCorrection;
if (suggestedWords.size() > 0) {
if (suggestedWords.mWillAutoCorrect) {