From e3afb7d19276676d28ca018e5f156892e137a96e Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Tue, 13 Mar 2012 20:33:13 +0900 Subject: [PATCH] Make the Builder fully immutable at last Change-Id: Ie399ca7a9e76ccab44a92bc378d11f92392fed2c --- java/src/com/android/inputmethod/latin/LatinIME.java | 6 ++++-- .../com/android/inputmethod/latin/SettingsValues.java | 6 ++++-- java/src/com/android/inputmethod/latin/Suggest.java | 9 ++++----- .../com/android/inputmethod/latin/SuggestedWords.java | 11 ++++------- 4 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 def639dce..ec408792c 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -930,7 +930,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar false /* typedWordValid */, false /* hasMinimalSuggestion */, false /* allowsToBeAutoCorrected */, - false /* isPunctuationSuggestions */); + false /* isPunctuationSuggestions */, + false /* shouldBlockAutoCorrectionBySafetyNet */); // When in fullscreen mode, show completions generated by the application final SuggestedWords words = builder.build(); final boolean isAutoCorrection = false; @@ -1794,7 +1795,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar false /* typedWordValid */, false /* hasMinimalSuggestion */, false /* allowsToBeAutoCorrected */, - false /* isPunctuationSuggestions */); + false /* isPunctuationSuggestions */, + false /* shouldBlockAutoCorrectionBySafetyNet */); 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 0a4aea140..7ae95326b 100644 --- a/java/src/com/android/inputmethod/latin/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/SettingsValues.java @@ -187,7 +187,8 @@ public class SettingsValues { false /* typedWordValid */, false /* hasMinimalSuggestion */, false /* allowsToBeAutoCorrected */, - true /* isPunctuationSuggestions */); + true /* isPunctuationSuggestions */, + false /* shouldBlockAutoCorrectionBySafetyNet */); return builder.build(); } @@ -209,7 +210,8 @@ public class SettingsValues { false /* typedWordValid */, false /* hasMinimalSuggestion */, false /* allowsToBeAutoCorrected */, - true /* isPunctuationSuggestions */); + true /* isPunctuationSuggestions */, + false /* shouldBlockAutoCorrectionBySafetyNet */); return builder.build(); } diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 4dee4f3b4..b02c9738e 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -274,7 +274,8 @@ public class Suggest implements Dictionary.WordCallback { false /* typedWordValid */, false /* hasMinimalSuggestion */, false /* allowsToBeAutoCorrected */, - false /* isPunctuationSuggestions */); + false /* isPunctuationSuggestions */, + false /* shouldBlockAutoCorrectionBySafetyNet */); } // TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder @@ -449,10 +450,8 @@ public class Suggest implements Dictionary.WordCallback { !allowsToBeAutoCorrected /* typedWordValid */, autoCorrectionAvailable /* hasMinimalSuggestion */, allowsToBeAutoCorrected /* allowsToBeAutoCorrected */, - false /* isPunctuationSuggestions */); - if (shouldBlockAutoCorrectionBySatefyNet) { - builder.setShouldBlockAutoCorrectionBySafetyNet(); - } + false /* isPunctuationSuggestions */, + shouldBlockAutoCorrectionBySatefyNet); return builder; } diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index bc89941a1..03ff5de7b 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -80,7 +80,7 @@ public class SuggestedWords { private final boolean mTypedWordValid; private final boolean mHasMinimalSuggestion; private final boolean mIsPunctuationSuggestions; - private boolean mShouldBlockAutoCorrectionBySafetyNet; + private final boolean mShouldBlockAutoCorrectionBySafetyNet; private final boolean mAllowsToBeAutoCorrected; private final List mSuggestedWordInfoList; @@ -88,12 +88,14 @@ public class SuggestedWords { final boolean typedWordValid, final boolean hasMinimalSuggestion, final boolean allowsToBeAutoCorrected, - final boolean isPunctuationSuggestions) { + final boolean isPunctuationSuggestions, + final boolean shouldBlockAutoCorrectionBySafetyNet) { mSuggestedWordInfoList = suggestedWordInfoList; mTypedWordValid = typedWordValid; mHasMinimalSuggestion = hasMinimalSuggestion; mAllowsToBeAutoCorrected = allowsToBeAutoCorrected; mIsPunctuationSuggestions = isPunctuationSuggestions; + mShouldBlockAutoCorrectionBySafetyNet = shouldBlockAutoCorrectionBySafetyNet; } public static ArrayList getFromCharSequenceList( @@ -114,11 +116,6 @@ public class SuggestedWords { return result; } - public Builder setShouldBlockAutoCorrectionBySafetyNet() { - mShouldBlockAutoCorrectionBySafetyNet = true; - 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(