aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-03-09 18:36:07 +0900
committerJean Chalard <jchalard@google.com>2012-03-09 19:00:29 +0900
commit0cf422fbb763e2672fb2f9e8e1e8af91d2e87cb3 (patch)
treef0db72b2f727ef913ee064538860e4b2851b1396 /java/src
parenta333ff19ef330c93287cfa0f6568d0cdcd431b04 (diff)
downloadlatinime-0cf422fbb763e2672fb2f9e8e1e8af91d2e87cb3.tar.gz
latinime-0cf422fbb763e2672fb2f9e8e1e8af91d2e87cb3.tar.xz
latinime-0cf422fbb763e2672fb2f9e8e1e8af91d2e87cb3.zip
Reduction, step 8
Change-Id: I54334039597e235e24f169e34c1d44109180ee88
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java6
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java26
2 files changed, 16 insertions, 16 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 439f1258f..509849467 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -2038,7 +2038,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM) {
final CharSequence prevWord = EditingUtils.getThisWord(getCurrentInputConnection(),
mSettingsValues.mWordSeparators);
- builder = mSuggest.getBigramPredictionWordBuilder(prevWord);
+ if (!TextUtils.isEmpty(prevWord)) {
+ builder = mSuggest.getBigramPredictionWordBuilder(prevWord);
+ } else {
+ builder = null;
+ }
} else {
builder = null;
}
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index b8ec5ff9d..f3ba1e5a7 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -276,21 +276,17 @@ public class Suggest implements Dictionary.WordCallback {
Arrays.fill(mBigramScores, 0);
collectGarbage(mBigramSuggestions, PREF_MAX_BIGRAMS);
- // Note that if prevWordForBigram is empty, we'll always return the same empty
- // SuggestedWords.Builder
- if (!TextUtils.isEmpty(prevWordForBigram)) {
- CharSequence lowerPrevWord = prevWordForBigram.toString().toLowerCase();
- if (mMainDict != null && mMainDict.isValidWord(lowerPrevWord)) {
- prevWordForBigram = lowerPrevWord;
- }
- for (final Dictionary dictionary : mBigramDictionaries.values()) {
- dictionary.getBigrams(sEmptyWordComposer, prevWordForBigram, this);
- }
- // Nothing entered: return all bigrams for the previous word
- int insertCount = Math.min(mBigramSuggestions.size(), mPrefMaxSuggestions);
- for (int i = 0; i < insertCount; ++i) {
- addBigramToSuggestions(mBigramSuggestions.get(i));
- }
+ CharSequence lowerPrevWord = prevWordForBigram.toString().toLowerCase();
+ if (mMainDict != null && mMainDict.isValidWord(lowerPrevWord)) {
+ prevWordForBigram = lowerPrevWord;
+ }
+ for (final Dictionary dictionary : mBigramDictionaries.values()) {
+ dictionary.getBigrams(sEmptyWordComposer, prevWordForBigram, this);
+ }
+ // Nothing entered: return all bigrams for the previous word
+ int insertCount = Math.min(mBigramSuggestions.size(), mPrefMaxSuggestions);
+ for (int i = 0; i < insertCount; ++i) {
+ addBigramToSuggestions(mBigramSuggestions.get(i));
}
StringUtils.removeDupes(mSuggestions);