Make some more Builder attributes final.
Change-Id: I3132b7fe4ee97c566736bfc21c3783cfc79fc7ff
This commit is contained in:
parent
c60fea852d
commit
b5eeb724fc
4 changed files with 29 additions and 27 deletions
|
@ -926,7 +926,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
final List<SuggestedWords.SuggestedWordInfo> applicationSuggestedWords =
|
final List<SuggestedWords.SuggestedWordInfo> applicationSuggestedWords =
|
||||||
SuggestedWords.Builder.getFromApplicationSpecifiedCompletions(
|
SuggestedWords.Builder.getFromApplicationSpecifiedCompletions(
|
||||||
applicationSpecifiedCompletions);
|
applicationSpecifiedCompletions);
|
||||||
SuggestedWords.Builder builder = new SuggestedWords.Builder(applicationSuggestedWords)
|
SuggestedWords.Builder builder = new SuggestedWords.Builder(applicationSuggestedWords,
|
||||||
|
false /* allowsToBeAutoCorrected */,
|
||||||
|
false /* isPunctuationSuggestions */)
|
||||||
.setTypedWordValid(false)
|
.setTypedWordValid(false)
|
||||||
.setHasMinimalSuggestion(false);
|
.setHasMinimalSuggestion(false);
|
||||||
// When in fullscreen mode, show completions generated by the application
|
// When in fullscreen mode, show completions generated by the application
|
||||||
|
@ -1786,9 +1788,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
SuggestedWords.Builder.getTypedWordAndPreviousSuggestions(
|
SuggestedWords.Builder.getTypedWordAndPreviousSuggestions(
|
||||||
typedWord, previousSuggestions);
|
typedWord, previousSuggestions);
|
||||||
final SuggestedWords.Builder obsoleteSuggestionsBuilder =
|
final SuggestedWords.Builder obsoleteSuggestionsBuilder =
|
||||||
new SuggestedWords.Builder(typedWordAndPreviousSuggestions)
|
new SuggestedWords.Builder(typedWordAndPreviousSuggestions,
|
||||||
.setTypedWordValid(false)
|
false /* allowsToBeAutoCorrected */,
|
||||||
.setHasMinimalSuggestion(false);
|
false /* isPunctuationSuggestions */)
|
||||||
|
.setTypedWordValid(false)
|
||||||
|
.setHasMinimalSuggestion(false);
|
||||||
|
|
||||||
showSuggestions(obsoleteSuggestionsBuilder.build(), typedWord);
|
showSuggestions(obsoleteSuggestionsBuilder.build(), typedWord);
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,8 +183,9 @@ public class SettingsValues {
|
||||||
KeySpecParser.getLabel(puncSpec)));
|
KeySpecParser.getLabel(puncSpec)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final SuggestedWords.Builder builder = new SuggestedWords.Builder(puncList)
|
final SuggestedWords.Builder builder = new SuggestedWords.Builder(puncList,
|
||||||
.setIsPunctuationSuggestions();
|
false /* allowsToBeAutoCorrected */,
|
||||||
|
true /* isPunctuationSuggestions */);
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,8 +203,9 @@ public class SettingsValues {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final SuggestedWords.Builder builder = new SuggestedWords.Builder(puncOutputTextList)
|
final SuggestedWords.Builder builder = new SuggestedWords.Builder(puncOutputTextList,
|
||||||
.setIsPunctuationSuggestions();
|
false /* allowsToBeAutoCorrected */,
|
||||||
|
true /* isPunctuationSuggestions */);
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,8 +270,9 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
StringUtils.removeDupes(mSuggestions);
|
StringUtils.removeDupes(mSuggestions);
|
||||||
|
|
||||||
return new SuggestedWords.Builder(
|
return new SuggestedWords.Builder(
|
||||||
SuggestedWords.Builder.getFromCharSequenceList(mSuggestions))
|
SuggestedWords.Builder.getFromCharSequenceList(mSuggestions),
|
||||||
.setAllowsToBeAutoCorrected(false);
|
false /* allowsToBeAutoCorrected */,
|
||||||
|
false /* isPunctuationSuggestions */);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder
|
// 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),
|
scoreInfoList.add(new SuggestedWords.SuggestedWordInfo(mSuggestions.get(i),
|
||||||
"--", false));
|
"--", false));
|
||||||
}
|
}
|
||||||
builder = new SuggestedWords.Builder(scoreInfoList)
|
builder = new SuggestedWords.Builder(scoreInfoList, allowsToBeAutoCorrected,
|
||||||
.setAllowsToBeAutoCorrected(allowsToBeAutoCorrected);
|
false /* isPunctuationSuggestions */);
|
||||||
} else {
|
} else {
|
||||||
builder = new SuggestedWords.Builder(
|
builder = new SuggestedWords.Builder(
|
||||||
SuggestedWords.Builder.getFromCharSequenceList(mSuggestions))
|
SuggestedWords.Builder.getFromCharSequenceList(mSuggestions),
|
||||||
.setAllowsToBeAutoCorrected(allowsToBeAutoCorrected);
|
allowsToBeAutoCorrected,
|
||||||
|
false /* isPunctuationSuggestions */);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean autoCorrectionAvailable = hasAutoCorrection;
|
boolean autoCorrectionAvailable = hasAutoCorrection;
|
||||||
|
|
|
@ -75,13 +75,17 @@ public class SuggestedWords {
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private boolean mTypedWordValid;
|
private boolean mTypedWordValid;
|
||||||
private boolean mHasMinimalSuggestion;
|
private boolean mHasMinimalSuggestion;
|
||||||
private boolean mIsPunctuationSuggestions;
|
private final boolean mIsPunctuationSuggestions;
|
||||||
private boolean mShouldBlockAutoCorrectionBySafetyNet;
|
private boolean mShouldBlockAutoCorrectionBySafetyNet;
|
||||||
private 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 allowsToBeAutoCorrected,
|
||||||
|
final boolean isPunctuationSuggestions) {
|
||||||
mSuggestedWordInfoList = suggestedWordInfoList;
|
mSuggestedWordInfoList = suggestedWordInfoList;
|
||||||
|
mAllowsToBeAutoCorrected = allowsToBeAutoCorrected;
|
||||||
|
mIsPunctuationSuggestions = isPunctuationSuggestions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<SuggestedWordInfo> getFromCharSequenceList(
|
public static List<SuggestedWordInfo> getFromCharSequenceList(
|
||||||
|
@ -112,21 +116,11 @@ public class SuggestedWords {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setIsPunctuationSuggestions() {
|
|
||||||
mIsPunctuationSuggestions = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder setShouldBlockAutoCorrectionBySafetyNet() {
|
public Builder setShouldBlockAutoCorrectionBySafetyNet() {
|
||||||
mShouldBlockAutoCorrectionBySafetyNet = true;
|
mShouldBlockAutoCorrectionBySafetyNet = true;
|
||||||
return this;
|
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
|
// 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(
|
||||||
|
|
Loading…
Reference in a new issue