Merge "Make the Builder fully immutable at last"

main
Jean Chalard 2012-03-13 20:30:16 -07:00 committed by Android (Google) Code Review
commit 7b2d6a8f98
4 changed files with 16 additions and 16 deletions

View File

@ -930,7 +930,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
false /* typedWordValid */, false /* typedWordValid */,
false /* hasMinimalSuggestion */, false /* hasMinimalSuggestion */,
false /* allowsToBeAutoCorrected */, false /* allowsToBeAutoCorrected */,
false /* isPunctuationSuggestions */); false /* isPunctuationSuggestions */,
false /* shouldBlockAutoCorrectionBySafetyNet */);
// When in fullscreen mode, show completions generated by the application // When in fullscreen mode, show completions generated by the application
final SuggestedWords words = builder.build(); final SuggestedWords words = builder.build();
final boolean isAutoCorrection = false; final boolean isAutoCorrection = false;
@ -1794,7 +1795,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
false /* typedWordValid */, false /* typedWordValid */,
false /* hasMinimalSuggestion */, false /* hasMinimalSuggestion */,
false /* allowsToBeAutoCorrected */, false /* allowsToBeAutoCorrected */,
false /* isPunctuationSuggestions */); false /* isPunctuationSuggestions */,
false /* shouldBlockAutoCorrectionBySafetyNet */);
showSuggestions(obsoleteSuggestionsBuilder.build(), typedWord); showSuggestions(obsoleteSuggestionsBuilder.build(), typedWord);
} }
} }

View File

@ -187,7 +187,8 @@ public class SettingsValues {
false /* typedWordValid */, false /* typedWordValid */,
false /* hasMinimalSuggestion */, false /* hasMinimalSuggestion */,
false /* allowsToBeAutoCorrected */, false /* allowsToBeAutoCorrected */,
true /* isPunctuationSuggestions */); true /* isPunctuationSuggestions */,
false /* shouldBlockAutoCorrectionBySafetyNet */);
return builder.build(); return builder.build();
} }
@ -209,7 +210,8 @@ public class SettingsValues {
false /* typedWordValid */, false /* typedWordValid */,
false /* hasMinimalSuggestion */, false /* hasMinimalSuggestion */,
false /* allowsToBeAutoCorrected */, false /* allowsToBeAutoCorrected */,
true /* isPunctuationSuggestions */); true /* isPunctuationSuggestions */,
false /* shouldBlockAutoCorrectionBySafetyNet */);
return builder.build(); return builder.build();
} }

View File

@ -274,7 +274,8 @@ public class Suggest implements Dictionary.WordCallback {
false /* typedWordValid */, false /* typedWordValid */,
false /* hasMinimalSuggestion */, false /* hasMinimalSuggestion */,
false /* allowsToBeAutoCorrected */, false /* allowsToBeAutoCorrected */,
false /* isPunctuationSuggestions */); false /* isPunctuationSuggestions */,
false /* shouldBlockAutoCorrectionBySafetyNet */);
} }
// TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder // TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder
@ -449,10 +450,8 @@ public class Suggest implements Dictionary.WordCallback {
!allowsToBeAutoCorrected /* typedWordValid */, !allowsToBeAutoCorrected /* typedWordValid */,
autoCorrectionAvailable /* hasMinimalSuggestion */, autoCorrectionAvailable /* hasMinimalSuggestion */,
allowsToBeAutoCorrected /* allowsToBeAutoCorrected */, allowsToBeAutoCorrected /* allowsToBeAutoCorrected */,
false /* isPunctuationSuggestions */); false /* isPunctuationSuggestions */,
if (shouldBlockAutoCorrectionBySatefyNet) { shouldBlockAutoCorrectionBySatefyNet);
builder.setShouldBlockAutoCorrectionBySafetyNet();
}
return builder; return builder;
} }

View File

@ -80,7 +80,7 @@ public class SuggestedWords {
private final boolean mTypedWordValid; private final boolean mTypedWordValid;
private final boolean mHasMinimalSuggestion; private final boolean mHasMinimalSuggestion;
private final boolean mIsPunctuationSuggestions; private final boolean mIsPunctuationSuggestions;
private boolean mShouldBlockAutoCorrectionBySafetyNet; private final boolean mShouldBlockAutoCorrectionBySafetyNet;
private final boolean mAllowsToBeAutoCorrected; private final boolean mAllowsToBeAutoCorrected;
private final List<SuggestedWordInfo> mSuggestedWordInfoList; private final List<SuggestedWordInfo> mSuggestedWordInfoList;
@ -88,12 +88,14 @@ public class SuggestedWords {
final boolean typedWordValid, final boolean typedWordValid,
final boolean hasMinimalSuggestion, final boolean hasMinimalSuggestion,
final boolean allowsToBeAutoCorrected, final boolean allowsToBeAutoCorrected,
final boolean isPunctuationSuggestions) { final boolean isPunctuationSuggestions,
final boolean shouldBlockAutoCorrectionBySafetyNet) {
mSuggestedWordInfoList = suggestedWordInfoList; mSuggestedWordInfoList = suggestedWordInfoList;
mTypedWordValid = typedWordValid; mTypedWordValid = typedWordValid;
mHasMinimalSuggestion = hasMinimalSuggestion; mHasMinimalSuggestion = hasMinimalSuggestion;
mAllowsToBeAutoCorrected = allowsToBeAutoCorrected; mAllowsToBeAutoCorrected = allowsToBeAutoCorrected;
mIsPunctuationSuggestions = isPunctuationSuggestions; mIsPunctuationSuggestions = isPunctuationSuggestions;
mShouldBlockAutoCorrectionBySafetyNet = shouldBlockAutoCorrectionBySafetyNet;
} }
public static ArrayList<SuggestedWordInfo> getFromCharSequenceList( public static ArrayList<SuggestedWordInfo> getFromCharSequenceList(
@ -114,11 +116,6 @@ public class SuggestedWords {
return result; return result;
} }
public Builder setShouldBlockAutoCorrectionBySafetyNet() {
mShouldBlockAutoCorrectionBySafetyNet = true;
return this;
}
// Should get rid of the first one (what the user typed previously) from suggestions // Should get rid of the first one (what the user typed previously) from suggestions
// and replace it with what the user currently typed. // and replace it with what the user currently typed.
public static ArrayList<SuggestedWordInfo> getTypedWordAndPreviousSuggestions( public static ArrayList<SuggestedWordInfo> getTypedWordAndPreviousSuggestions(