Make still more members of the Builder final.
Change-Id: Ic455f97247da5e40d4939555ab639ecffef36e2d
This commit is contained in:
parent
edf5daa8ed
commit
2e2519ee91
4 changed files with 22 additions and 22 deletions
|
@ -927,10 +927,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
SuggestedWords.Builder.getFromApplicationSpecifiedCompletions(
|
SuggestedWords.Builder.getFromApplicationSpecifiedCompletions(
|
||||||
applicationSpecifiedCompletions);
|
applicationSpecifiedCompletions);
|
||||||
SuggestedWords.Builder builder = new SuggestedWords.Builder(applicationSuggestedWords,
|
SuggestedWords.Builder builder = new SuggestedWords.Builder(applicationSuggestedWords,
|
||||||
|
false /* typedWordValid */,
|
||||||
|
false /* hasMinimalSuggestion */,
|
||||||
false /* allowsToBeAutoCorrected */,
|
false /* allowsToBeAutoCorrected */,
|
||||||
false /* isPunctuationSuggestions */)
|
false /* isPunctuationSuggestions */);
|
||||||
.setTypedWordValid(false)
|
|
||||||
.setHasMinimalSuggestion(false);
|
|
||||||
// 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;
|
||||||
|
@ -1789,11 +1789,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
typedWord, previousSuggestions);
|
typedWord, previousSuggestions);
|
||||||
final SuggestedWords.Builder obsoleteSuggestionsBuilder =
|
final SuggestedWords.Builder obsoleteSuggestionsBuilder =
|
||||||
new SuggestedWords.Builder(typedWordAndPreviousSuggestions,
|
new SuggestedWords.Builder(typedWordAndPreviousSuggestions,
|
||||||
|
false /* typedWordValid */,
|
||||||
|
false /* hasMinimalSuggestion */,
|
||||||
false /* allowsToBeAutoCorrected */,
|
false /* allowsToBeAutoCorrected */,
|
||||||
false /* isPunctuationSuggestions */)
|
false /* isPunctuationSuggestions */);
|
||||||
.setTypedWordValid(false)
|
|
||||||
.setHasMinimalSuggestion(false);
|
|
||||||
|
|
||||||
showSuggestions(obsoleteSuggestionsBuilder.build(), typedWord);
|
showSuggestions(obsoleteSuggestionsBuilder.build(), typedWord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,6 +184,8 @@ public class SettingsValues {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final SuggestedWords.Builder builder = new SuggestedWords.Builder(puncList,
|
final SuggestedWords.Builder builder = new SuggestedWords.Builder(puncList,
|
||||||
|
false /* typedWordValid */,
|
||||||
|
false /* hasMinimalSuggestion */,
|
||||||
false /* allowsToBeAutoCorrected */,
|
false /* allowsToBeAutoCorrected */,
|
||||||
true /* isPunctuationSuggestions */);
|
true /* isPunctuationSuggestions */);
|
||||||
return builder.build();
|
return builder.build();
|
||||||
|
@ -204,6 +206,8 @@ public class SettingsValues {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final SuggestedWords.Builder builder = new SuggestedWords.Builder(puncOutputTextList,
|
final SuggestedWords.Builder builder = new SuggestedWords.Builder(puncOutputTextList,
|
||||||
|
false /* typedWordValid */,
|
||||||
|
false /* hasMinimalSuggestion */,
|
||||||
false /* allowsToBeAutoCorrected */,
|
false /* allowsToBeAutoCorrected */,
|
||||||
true /* isPunctuationSuggestions */);
|
true /* isPunctuationSuggestions */);
|
||||||
return builder.build();
|
return builder.build();
|
||||||
|
|
|
@ -271,6 +271,8 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
|
|
||||||
return new SuggestedWords.Builder(
|
return new SuggestedWords.Builder(
|
||||||
SuggestedWords.Builder.getFromCharSequenceList(mSuggestions),
|
SuggestedWords.Builder.getFromCharSequenceList(mSuggestions),
|
||||||
|
false /* typedWordValid */,
|
||||||
|
false /* hasMinimalSuggestion */,
|
||||||
false /* allowsToBeAutoCorrected */,
|
false /* allowsToBeAutoCorrected */,
|
||||||
false /* isPunctuationSuggestions */);
|
false /* isPunctuationSuggestions */);
|
||||||
}
|
}
|
||||||
|
@ -435,10 +437,11 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
}
|
}
|
||||||
// Don't auto-correct words with multiple capital letter
|
// Don't auto-correct words with multiple capital letter
|
||||||
autoCorrectionAvailable &= !wordComposer.isMostlyCaps();
|
autoCorrectionAvailable &= !wordComposer.isMostlyCaps();
|
||||||
builder = new SuggestedWords.Builder(scoreInfoList, allowsToBeAutoCorrected,
|
builder = new SuggestedWords.Builder(scoreInfoList,
|
||||||
|
!allowsToBeAutoCorrected /* typedWordValid */,
|
||||||
|
autoCorrectionAvailable /* hasMinimalSuggestion */,
|
||||||
|
allowsToBeAutoCorrected /* allowsToBeAutoCorrected */,
|
||||||
false /* isPunctuationSuggestions */);
|
false /* isPunctuationSuggestions */);
|
||||||
builder.setTypedWordValid(!allowsToBeAutoCorrected).setHasMinimalSuggestion(
|
|
||||||
autoCorrectionAvailable);
|
|
||||||
if (allowsToBeAutoCorrected && builder.size() > 1 && mAutoCorrectionThreshold > 0
|
if (allowsToBeAutoCorrected && builder.size() > 1 && mAutoCorrectionThreshold > 0
|
||||||
&& Suggest.shouldBlockAutoCorrectionBySafetyNet(typedWord, builder.getWord(1))) {
|
&& Suggest.shouldBlockAutoCorrectionBySafetyNet(typedWord, builder.getWord(1))) {
|
||||||
builder.setShouldBlockAutoCorrectionBySafetyNet();
|
builder.setShouldBlockAutoCorrectionBySafetyNet();
|
||||||
|
|
|
@ -73,17 +73,21 @@ public class SuggestedWords {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private boolean mTypedWordValid;
|
private final boolean mTypedWordValid;
|
||||||
private boolean mHasMinimalSuggestion;
|
private final boolean mHasMinimalSuggestion;
|
||||||
private final boolean mIsPunctuationSuggestions;
|
private final boolean mIsPunctuationSuggestions;
|
||||||
private boolean mShouldBlockAutoCorrectionBySafetyNet;
|
private boolean mShouldBlockAutoCorrectionBySafetyNet;
|
||||||
private final boolean mAllowsToBeAutoCorrected;
|
private final boolean mAllowsToBeAutoCorrected;
|
||||||
private final List<SuggestedWordInfo> mSuggestedWordInfoList;
|
private final List<SuggestedWordInfo> mSuggestedWordInfoList;
|
||||||
|
|
||||||
public Builder(final List<SuggestedWordInfo> suggestedWordInfoList,
|
public Builder(final List<SuggestedWordInfo> suggestedWordInfoList,
|
||||||
|
final boolean typedWordValid,
|
||||||
|
final boolean hasMinimalSuggestion,
|
||||||
final boolean allowsToBeAutoCorrected,
|
final boolean allowsToBeAutoCorrected,
|
||||||
final boolean isPunctuationSuggestions) {
|
final boolean isPunctuationSuggestions) {
|
||||||
mSuggestedWordInfoList = suggestedWordInfoList;
|
mSuggestedWordInfoList = suggestedWordInfoList;
|
||||||
|
mTypedWordValid = typedWordValid;
|
||||||
|
mHasMinimalSuggestion = hasMinimalSuggestion;
|
||||||
mAllowsToBeAutoCorrected = allowsToBeAutoCorrected;
|
mAllowsToBeAutoCorrected = allowsToBeAutoCorrected;
|
||||||
mIsPunctuationSuggestions = isPunctuationSuggestions;
|
mIsPunctuationSuggestions = isPunctuationSuggestions;
|
||||||
}
|
}
|
||||||
|
@ -106,16 +110,6 @@ public class SuggestedWords {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setTypedWordValid(boolean typedWordValid) {
|
|
||||||
mTypedWordValid = typedWordValid;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder setHasMinimalSuggestion(boolean hasMinimalSuggestion) {
|
|
||||||
mHasMinimalSuggestion = hasMinimalSuggestion;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder setShouldBlockAutoCorrectionBySafetyNet() {
|
public Builder setShouldBlockAutoCorrectionBySafetyNet() {
|
||||||
mShouldBlockAutoCorrectionBySafetyNet = true;
|
mShouldBlockAutoCorrectionBySafetyNet = true;
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue