diff options
author | 2012-06-26 15:22:26 +0900 | |
---|---|---|
committer | 2012-06-26 17:36:47 +0900 | |
commit | 64dad2d5a958acf2bc53cce5cade4b8e2b34c05f (patch) | |
tree | 445c1d6297a48e774eee8f752c4b29bd7c949026 /java/src | |
parent | d522ddefc273c146d269e6d327b711e1e24d7baa (diff) | |
download | latinime-64dad2d5a958acf2bc53cce5cade4b8e2b34c05f.tar.gz latinime-64dad2d5a958acf2bc53cce5cade4b8e2b34c05f.tar.xz latinime-64dad2d5a958acf2bc53cce5cade4b8e2b34c05f.zip |
Remove an unused method and inline another (A10)
Change-Id: Ifd71ce79711b0c15c7764e97351dbb1b8e4c0c2d
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 53 |
1 files changed, 10 insertions, 43 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 61a8e2831..67c03f626 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -209,31 +209,6 @@ public class Suggest implements Dictionary.WordCallback { return sb; } - private static final WordComposer sEmptyWordComposer = new WordComposer(); - public SuggestedWords getBigramPredictions(CharSequence prevWordForBigram) { - LatinImeLogger.onStartSuggestion(prevWordForBigram); - mIsFirstCharCapitalized = false; - mIsAllUpperCase = false; - mTrailingSingleQuotesCount = 0; - mSuggestions = new ArrayList<SuggestedWordInfo>(MAX_SUGGESTIONS); - - // Treating USER_TYPED as UNIGRAM suggestion for logging now. - LatinImeLogger.onAddSuggestedWord("", Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM); - mConsideredWord = ""; - - getAllBigrams(prevWordForBigram, sEmptyWordComposer); - - SuggestedWordInfo.removeDups(mSuggestions); - - return new SuggestedWords(mSuggestions, - false /* typedWordValid */, - false /* hasAutoCorrectionCandidate */, - false /* allowsToBeAutoCorrected */, - false /* isPunctuationSuggestions */, - false /* isObsoleteSuggestions */, - true /* isPrediction */); - } - // Compatibility for tests. TODO: remove this public SuggestedWords getSuggestedWords( final WordComposer wordComposer, CharSequence prevWordForBigram, @@ -264,7 +239,16 @@ public class Suggest implements Dictionary.WordCallback { if (wordComposer.size() <= 1 && isCorrectionEnabled) { // At first character typed, search only the bigrams if (!TextUtils.isEmpty(prevWordForBigram)) { - getAllBigrams(prevWordForBigram, wordComposer); + if (StringUtils.hasUpperCase(prevWordForBigram)) { + // TODO: Must pay attention to locale when changing case. + final CharSequence lowerPrevWord = prevWordForBigram.toString().toLowerCase(); + for (final Dictionary dictionary : mBigramDictionaries.values()) { + dictionary.getBigrams(wordComposer, lowerPrevWord, this); + } + } + for (final Dictionary dictionary : mBigramDictionaries.values()) { + dictionary.getBigrams(wordComposer, prevWordForBigram, this); + } } } else if (wordComposer.size() > 1) { final WordComposer wordComposerForLookup; @@ -362,23 +346,6 @@ public class Suggest implements Dictionary.WordCallback { isPrediction); } - /** - * Adds all bigram predictions for prevWord. Also checks the lower case version of prevWord if - * it contains any upper case characters. - */ - private void getAllBigrams(final CharSequence prevWord, final WordComposer wordComposer) { - if (StringUtils.hasUpperCase(prevWord)) { - // TODO: Must pay attention to locale when changing case. - final CharSequence lowerPrevWord = prevWord.toString().toLowerCase(); - for (final Dictionary dictionary : mBigramDictionaries.values()) { - dictionary.getBigrams(wordComposer, lowerPrevWord, this); - } - } - for (final Dictionary dictionary : mBigramDictionaries.values()) { - dictionary.getBigrams(wordComposer, prevWord, this); - } - } - private static ArrayList<SuggestedWordInfo> getSuggestionsInfoListWithDebugInfo( final String typedWord, final ArrayList<SuggestedWordInfo> suggestions) { final SuggestedWordInfo typedWordInfo = suggestions.get(0); |