aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-07-05 01:47:59 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-07-05 01:47:59 -0700
commit71d7fc91b70085c0857dee2b8165e0f4d17e9d62 (patch)
tree532abecb30ae951f56f7cf151a09ff3eabfe5034 /java/src
parentac3ad6ef9f78eae844b47bd12e313966e522096c (diff)
parentcbfd2e1fdb83a2fc315b5b6351221f3d65afe25a (diff)
downloadlatinime-71d7fc91b70085c0857dee2b8165e0f4d17e9d62.tar.gz
latinime-71d7fc91b70085c0857dee2b8165e0f4d17e9d62.tar.xz
latinime-71d7fc91b70085c0857dee2b8165e0f4d17e9d62.zip
Merge "Pull up a common variable into the wrapping method (A50)"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index fba8d4a34..017292f9b 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1704,17 +1704,19 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return;
}
+ final CharSequence typedWord;
if (isPredictions || !mWordComposer.isComposingWord()) {
- updateBigramPredictions();
+ typedWord = "";
+ updateBigramPredictions(typedWord);
} else {
- updateSuggestions();
+ typedWord = mWordComposer.getTypedWord();
+ updateSuggestions(typedWord);
}
}
- private void updateSuggestions() {
+ private void updateSuggestions(final CharSequence typedWord) {
// TODO: May need a better way of retrieving previous word
final CharSequence prevWord = mConnection.getPreviousWord(mCurrentSettings.mWordSeparators);
- final CharSequence typedWord = mWordComposer.getTypedWord();
// getSuggestedWords handles gracefully a null value of prevWord
final SuggestedWords suggestedWords = mSuggest.getSuggestedWords(mWordComposer,
prevWord, mKeyboardSwitcher.getKeyboard().getProximityInfo(),
@@ -1921,7 +1923,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
separatorCode, prevWord);
}
- private void updateBigramPredictions() {
+ private void updateBigramPredictions(final CharSequence typedWord) {
if (!mCurrentSettings.mBigramPredictionEnabled) {
setPunctuationSuggestions();
return;
@@ -1942,9 +1944,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
if (null != suggestedWords && suggestedWords.size() > 0) {
- // Explicitly supply an empty typed word (the no-second-arg version of
- // showSuggestions will retrieve the word near the cursor, we don't want that here)
- showSuggestions(suggestedWords, "");
+ // Typed word is always empty. We pass it because the no-second-arg version of
+ // showSuggestions will retrieve the word near the cursor, and we don't want that here
+ showSuggestions(suggestedWords, typedWord);
} else {
clearSuggestions();
}