diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index bd502a030..2bbda7848 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -926,7 +926,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final List applicationSuggestedWords = SuggestedWords.Builder.getFromApplicationSpecifiedCompletions( applicationSpecifiedCompletions); - SuggestedWords.Builder builder = new SuggestedWords.Builder(applicationSuggestedWords) + SuggestedWords.Builder builder = new SuggestedWords.Builder(applicationSuggestedWords, + false /* allowsToBeAutoCorrected */, + false /* isPunctuationSuggestions */) .setTypedWordValid(false) .setHasMinimalSuggestion(false); // When in fullscreen mode, show completions generated by the application @@ -1786,9 +1788,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar SuggestedWords.Builder.getTypedWordAndPreviousSuggestions( typedWord, previousSuggestions); final SuggestedWords.Builder obsoleteSuggestionsBuilder = - new SuggestedWords.Builder(typedWordAndPreviousSuggestions) - .setTypedWordValid(false) - .setHasMinimalSuggestion(false); + new SuggestedWords.Builder(typedWordAndPreviousSuggestions, + false /* allowsToBeAutoCorrected */, + false /* isPunctuationSuggestions */) + .setTypedWordValid(false) + .setHasMinimalSuggestion(false); showSuggestions(obsoleteSuggestionsBuilder.build(), typedWord); } diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java index 591f9f5a7..c5198b337 100644 --- a/java/src/com/android/inputmethod/latin/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/SettingsValues.java @@ -183,8 +183,9 @@ public class SettingsValues { KeySpecParser.getLabel(puncSpec))); } } - final SuggestedWords.Builder builder = new SuggestedWords.Builder(puncList) - .setIsPunctuationSuggestions(); + final SuggestedWords.Builder builder = new SuggestedWords.Builder(puncList, + false /* allowsToBeAutoCorrected */, + true /* isPunctuationSuggestions */); return builder.build(); } @@ -202,8 +203,9 @@ public class SettingsValues { } } } - final SuggestedWords.Builder builder = new SuggestedWords.Builder(puncOutputTextList) - .setIsPunctuationSuggestions(); + final SuggestedWords.Builder builder = new SuggestedWords.Builder(puncOutputTextList, + false /* allowsToBeAutoCorrected */, + true /* isPunctuationSuggestions */); return builder.build(); } diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 40e9ef8e7..fd813c9a2 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -270,8 +270,9 @@ public class Suggest implements Dictionary.WordCallback { StringUtils.removeDupes(mSuggestions); return new SuggestedWords.Builder( - SuggestedWords.Builder.getFromCharSequenceList(mSuggestions)) - .setAllowsToBeAutoCorrected(false); + SuggestedWords.Builder.getFromCharSequenceList(mSuggestions), + false /* allowsToBeAutoCorrected */, + false /* isPunctuationSuggestions */); } // TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder @@ -423,12 +424,13 @@ public class Suggest implements Dictionary.WordCallback { scoreInfoList.add(new SuggestedWords.SuggestedWordInfo(mSuggestions.get(i), "--", false)); } - builder = new SuggestedWords.Builder(scoreInfoList) - .setAllowsToBeAutoCorrected(allowsToBeAutoCorrected); + builder = new SuggestedWords.Builder(scoreInfoList, allowsToBeAutoCorrected, + false /* isPunctuationSuggestions */); } else { builder = new SuggestedWords.Builder( - SuggestedWords.Builder.getFromCharSequenceList(mSuggestions)) - .setAllowsToBeAutoCorrected(allowsToBeAutoCorrected); + SuggestedWords.Builder.getFromCharSequenceList(mSuggestions), + allowsToBeAutoCorrected, + false /* isPunctuationSuggestions */); } boolean autoCorrectionAvailable = hasAutoCorrection; diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index 676563e1d..d41f84798 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -75,13 +75,17 @@ public class SuggestedWords { public static class Builder { private boolean mTypedWordValid; private boolean mHasMinimalSuggestion; - private boolean mIsPunctuationSuggestions; + private final boolean mIsPunctuationSuggestions; private boolean mShouldBlockAutoCorrectionBySafetyNet; - private boolean mAllowsToBeAutoCorrected; + private final boolean mAllowsToBeAutoCorrected; private final List mSuggestedWordInfoList; - public Builder(final List suggestedWordInfoList) { + public Builder(final List suggestedWordInfoList, + final boolean allowsToBeAutoCorrected, + final boolean isPunctuationSuggestions) { mSuggestedWordInfoList = suggestedWordInfoList; + mAllowsToBeAutoCorrected = allowsToBeAutoCorrected; + mIsPunctuationSuggestions = isPunctuationSuggestions; } public static List getFromCharSequenceList( @@ -112,21 +116,11 @@ public class SuggestedWords { return this; } - public Builder setIsPunctuationSuggestions() { - mIsPunctuationSuggestions = true; - return this; - } - public Builder setShouldBlockAutoCorrectionBySafetyNet() { mShouldBlockAutoCorrectionBySafetyNet = true; return this; } - public Builder setAllowsToBeAutoCorrected(final boolean allowsToBeAutoCorrected) { - mAllowsToBeAutoCorrected = allowsToBeAutoCorrected; - return this; - } - // Should get rid of the first one (what the user typed previously) from suggestions // and replace it with what the user currently typed. public static ArrayList getTypedWordAndPreviousSuggestions(