diff options
author | 2012-06-26 01:35:15 -0700 | |
---|---|---|
committer | 2012-06-26 01:35:15 -0700 | |
commit | d522ddefc273c146d269e6d327b711e1e24d7baa (patch) | |
tree | af1115406872b50a70eb2730cd4ac3044deee61f /java/src/com/android/inputmethod/latin/Suggest.java | |
parent | 90981e423a9e707b2593d48abd67097058c17991 (diff) | |
parent | 28eeb35d149468514a65379e9d0d1672cf26981e (diff) | |
download | latinime-d522ddefc273c146d269e6d327b711e1e24d7baa.tar.gz latinime-d522ddefc273c146d269e6d327b711e1e24d7baa.tar.xz latinime-d522ddefc273c146d269e6d327b711e1e24d7baa.zip |
Merge "Merge the interface of two methods that do the same thing (A9)"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 2f22df34b..61a8e2831 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -234,13 +234,22 @@ public class Suggest implements Dictionary.WordCallback { true /* isPrediction */); } - // TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder + // Compatibility for tests. TODO: remove this public SuggestedWords getSuggestedWords( final WordComposer wordComposer, CharSequence prevWordForBigram, final ProximityInfo proximityInfo, final boolean isCorrectionEnabled) { + return getSuggestedWords(wordComposer, prevWordForBigram, proximityInfo, + isCorrectionEnabled, false); + } + + // TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder + public SuggestedWords getSuggestedWords( + final WordComposer wordComposer, CharSequence prevWordForBigram, + final ProximityInfo proximityInfo, final boolean isCorrectionEnabled, + final boolean isPrediction) { LatinImeLogger.onStartSuggestion(prevWordForBigram); - mIsFirstCharCapitalized = wordComposer.isFirstCharCapitalized(); - mIsAllUpperCase = wordComposer.isAllUpperCase(); + mIsFirstCharCapitalized = !isPrediction && wordComposer.isFirstCharCapitalized(); + mIsAllUpperCase = !isPrediction && wordComposer.isAllUpperCase(); mTrailingSingleQuotesCount = wordComposer.trailingSingleQuotesCount(); mSuggestions = new ArrayList<SuggestedWordInfo>(MAX_SUGGESTIONS); @@ -305,12 +314,14 @@ public class Suggest implements Dictionary.WordCallback { } } - mSuggestions.add(0, new SuggestedWordInfo(typedWord, SuggestedWordInfo.MAX_SCORE, - SuggestedWordInfo.KIND_TYPED)); + if (!isPrediction) { + mSuggestions.add(0, new SuggestedWordInfo(typedWord, SuggestedWordInfo.MAX_SCORE, + SuggestedWordInfo.KIND_TYPED)); + } SuggestedWordInfo.removeDups(mSuggestions); final ArrayList<SuggestedWordInfo> suggestionsList; - if (DBG) { + if (DBG && !mSuggestions.isEmpty()) { suggestionsList = getSuggestionsInfoListWithDebugInfo(typedWord, mSuggestions); } else { suggestionsList = mSuggestions; @@ -343,12 +354,12 @@ public class Suggest implements Dictionary.WordCallback { autoCorrectionAvailable = false; } return new SuggestedWords(suggestionsList, - !allowsToBeAutoCorrected /* typedWordValid */, - autoCorrectionAvailable /* hasAutoCorrectionCandidate */, - allowsToBeAutoCorrected /* allowsToBeAutoCorrected */, + !isPrediction && !allowsToBeAutoCorrected /* typedWordValid */, + !isPrediction && autoCorrectionAvailable /* hasAutoCorrectionCandidate */, + !isPrediction && allowsToBeAutoCorrected /* allowsToBeAutoCorrected */, false /* isPunctuationSuggestions */, false /* isObsoleteSuggestions */, - false /* isPrediction */); + isPrediction); } /** |