From 5a61d03f318c2813c75b2c2e7057019f9ad472c7 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 9 Mar 2012 18:13:48 +0900 Subject: Reduction, step 3 Change-Id: I0e08b102c9539d97c473505b9d42176c4a7c8853 --- .../src/com/android/inputmethod/latin/Suggest.java | 43 ++++------------------ 1 file changed, 7 insertions(+), 36 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 30226812d..2e88ad4c1 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -300,33 +300,14 @@ public class Suggest implements Dictionary.WordCallback { for (final Dictionary dictionary : mBigramDictionaries.values()) { dictionary.getBigrams(wordComposer, prevWordForBigram, this); } - if (true) { - // 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)); - } - } else { - // Word entered: return only bigrams that match the first char of the typed word - final char currentChar = consideredWord.charAt(0); - // TODO: Must pay attention to locale when changing case. - final char currentCharUpper = Character.toUpperCase(currentChar); - int count = 0; - final int bigramSuggestionSize = mBigramSuggestions.size(); - for (int i = 0; i < bigramSuggestionSize; i++) { - final CharSequence bigramSuggestion = mBigramSuggestions.get(i); - final char bigramSuggestionFirstChar = bigramSuggestion.charAt(0); - if (bigramSuggestionFirstChar == currentChar - || bigramSuggestionFirstChar == currentCharUpper) { - addBigramToSuggestions(bigramSuggestion); - if (++count > mPrefMaxSuggestions) break; - } - } + // 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 whitelistedWord = capitalizeWord(mIsAllUpperCase, mIsFirstCharCapitalized, - null); + CharSequence whitelistedWord = null; final boolean hasAutoCorrection; if (CORRECTION_FULL == correctionMode @@ -337,18 +318,8 @@ public class Suggest implements Dictionary.WordCallback { hasAutoCorrection = false; } - if (whitelistedWord != null) { - if (mTrailingSingleQuotesCount > 0) { - final StringBuilder sb = new StringBuilder(whitelistedWord); - for (int i = mTrailingSingleQuotesCount - 1; i >= 0; --i) { - sb.appendCodePoint(Keyboard.CODE_SINGLE_QUOTE); - } - mSuggestions.add(0, sb.toString()); - } else { - mSuggestions.add(0, whitelistedWord); - } - } - + // TODO: SuggestedWords.Builder#addWord will not insert any isEmpty() word, so the + // following is useless mSuggestions.add(0, typedWord); StringUtils.removeDupes(mSuggestions); -- cgit v1.2.3-83-g751a