Merge "Make an add into a set."

main
Jean Chalard 2012-03-13 03:35:17 -07:00 committed by Android (Google) Code Review
commit 9ffaae71d9
4 changed files with 13 additions and 12 deletions

View File

@ -927,7 +927,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
SuggestedWords.Builder.getFromApplicationSpecifiedCompletions(
applicationSpecifiedCompletions);
SuggestedWords.Builder builder = new SuggestedWords.Builder()
.addWords(applicationSuggestedWords)
.setWords(applicationSuggestedWords)
.setTypedWordValid(false)
.setHasMinimalSuggestion(false);
// When in fullscreen mode, show completions generated by the application
@ -1787,7 +1787,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
SuggestedWords.Builder.getTypedWordAndPreviousSuggestions(
typedWord, previousSuggestions);
final SuggestedWords.Builder obsoleteSuggestionsBuilder = new SuggestedWords.Builder()
.addWords(typedWordAndPreviousSuggestions)
.setWords(typedWordAndPreviousSuggestions)
.setTypedWordValid(false)
.setHasMinimalSuggestion(false);

View File

@ -184,7 +184,7 @@ public class SettingsValues {
}
}
final SuggestedWords.Builder builder = new SuggestedWords.Builder()
.addWords(puncList)
.setWords(puncList)
.setIsPunctuationSuggestions();
return builder.build();
}
@ -204,7 +204,7 @@ public class SettingsValues {
}
}
final SuggestedWords.Builder builder = new SuggestedWords.Builder()
.addWords(puncOutputTextList)
.setWords(puncOutputTextList)
.setIsPunctuationSuggestions();
return builder.build();
}

View File

@ -270,7 +270,7 @@ public class Suggest implements Dictionary.WordCallback {
StringUtils.removeDupes(mSuggestions);
return new SuggestedWords.Builder()
.addWords(SuggestedWords.Builder.getFromCharSequenceList(mSuggestions))
.setWords(SuggestedWords.Builder.getFromCharSequenceList(mSuggestions))
.setAllowsToBeAutoCorrected(false)
.setHasAutoCorrection(false);
}
@ -424,12 +424,12 @@ public class Suggest implements Dictionary.WordCallback {
scoreInfoList.add(new SuggestedWords.SuggestedWordInfo(mSuggestions.get(i),
"--", false));
}
builder = new SuggestedWords.Builder().addWords(scoreInfoList)
builder = new SuggestedWords.Builder().setWords(scoreInfoList)
.setAllowsToBeAutoCorrected(allowsToBeAutoCorrected)
.setHasAutoCorrection(hasAutoCorrection);
} else {
builder = new SuggestedWords.Builder()
.addWords(SuggestedWords.Builder.getFromCharSequenceList(mSuggestions))
.setWords(SuggestedWords.Builder.getFromCharSequenceList(mSuggestions))
.setAllowsToBeAutoCorrected(allowsToBeAutoCorrected)
.setHasAutoCorrection(hasAutoCorrection);
}

View File

@ -87,12 +87,13 @@ public class SuggestedWords {
// Nothing to do here.
}
// TODO: compatibility for tests. Remove this once tests are okay.
public Builder addWords(List<SuggestedWordInfo> suggestedWordInfoList) {
final int N = suggestedWordInfoList.size();
for (int i = 0; i < N; ++i) {
SuggestedWordInfo suggestedWordInfo = suggestedWordInfoList.get(i);
addWord(suggestedWordInfo.mWord, suggestedWordInfo);
}
return setWords(suggestedWordInfoList);
}
public Builder setWords(List<SuggestedWordInfo> suggestedWordInfoList) {
mSuggestedWordInfoList = suggestedWordInfoList;
return this;
}