Make some more Builder attributes final.
Change-Id: I3132b7fe4ee97c566736bfc21c3783cfc79fc7ffmain
parent
c60fea852d
commit
b5eeb724fc
|
@ -926,7 +926,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||
final List<SuggestedWords.SuggestedWordInfo> 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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<SuggestedWordInfo> mSuggestedWordInfoList;
|
||||
|
||||
public Builder(final List<SuggestedWordInfo> suggestedWordInfoList) {
|
||||
public Builder(final List<SuggestedWordInfo> suggestedWordInfoList,
|
||||
final boolean allowsToBeAutoCorrected,
|
||||
final boolean isPunctuationSuggestions) {
|
||||
mSuggestedWordInfoList = suggestedWordInfoList;
|
||||
mAllowsToBeAutoCorrected = allowsToBeAutoCorrected;
|
||||
mIsPunctuationSuggestions = isPunctuationSuggestions;
|
||||
}
|
||||
|
||||
public static List<SuggestedWordInfo> 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<SuggestedWordInfo> getTypedWordAndPreviousSuggestions(
|
||||
|
|
Loading…
Reference in New Issue