Remove a useless parameter.
Change-Id: I7625bf17158c207ad7e8cd496bef825704173c4c
This commit is contained in:
parent
6fbcd0d219
commit
d0d4074392
4 changed files with 40 additions and 27 deletions
|
@ -922,11 +922,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<CharSequence> applicationSuggestedWords =
|
final List<SuggestedWords.SuggestedWordInfo> applicationSuggestedWords =
|
||||||
SuggestedWords.Builder.getFromApplicationSpecifiedCompletions(
|
SuggestedWords.Builder.getFromApplicationSpecifiedCompletions(
|
||||||
applicationSpecifiedCompletions);
|
applicationSpecifiedCompletions);
|
||||||
SuggestedWords.Builder builder = new SuggestedWords.Builder()
|
SuggestedWords.Builder builder = new SuggestedWords.Builder()
|
||||||
.addWords(applicationSuggestedWords, null)
|
.addWords(applicationSuggestedWords)
|
||||||
.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
|
||||||
|
|
|
@ -175,32 +175,36 @@ public class SettingsValues {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SuggestedWords createSuggestPuncList(final String[] puncs) {
|
private static SuggestedWords createSuggestPuncList(final String[] puncs) {
|
||||||
final ArrayList<CharSequence> puncList = new ArrayList<CharSequence>();
|
final ArrayList<SuggestedWords.SuggestedWordInfo> puncList =
|
||||||
|
new ArrayList<SuggestedWords.SuggestedWordInfo>();
|
||||||
if (puncs != null) {
|
if (puncs != null) {
|
||||||
for (final String puncSpec : puncs) {
|
for (final String puncSpec : puncs) {
|
||||||
puncList.add(KeySpecParser.getLabel(puncSpec));
|
puncList.add(new SuggestedWords.SuggestedWordInfo(
|
||||||
|
KeySpecParser.getLabel(puncSpec)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final SuggestedWords.Builder builder = new SuggestedWords.Builder()
|
final SuggestedWords.Builder builder = new SuggestedWords.Builder()
|
||||||
.addWords(puncList, null)
|
.addWords(puncList)
|
||||||
.setIsPunctuationSuggestions();
|
.setIsPunctuationSuggestions();
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SuggestedWords createSuggestPuncOutputTextList(final String[] puncs) {
|
private static SuggestedWords createSuggestPuncOutputTextList(final String[] puncs) {
|
||||||
final ArrayList<CharSequence> puncOutputTextList = new ArrayList<CharSequence>();
|
final ArrayList<SuggestedWords.SuggestedWordInfo> puncOutputTextList =
|
||||||
|
new ArrayList<SuggestedWords.SuggestedWordInfo>();
|
||||||
if (puncs != null) {
|
if (puncs != null) {
|
||||||
for (final String puncSpec : puncs) {
|
for (final String puncSpec : puncs) {
|
||||||
final String outputText = KeySpecParser.getOutputText(puncSpec);
|
final String outputText = KeySpecParser.getOutputText(puncSpec);
|
||||||
if (outputText != null) {
|
if (outputText != null) {
|
||||||
puncOutputTextList.add(outputText);
|
puncOutputTextList.add(new SuggestedWords.SuggestedWordInfo(outputText));
|
||||||
} else {
|
} else {
|
||||||
puncOutputTextList.add(KeySpecParser.getLabel(puncSpec));
|
puncOutputTextList.add(new SuggestedWords.SuggestedWordInfo(
|
||||||
|
KeySpecParser.getLabel(puncSpec)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final SuggestedWords.Builder builder = new SuggestedWords.Builder()
|
final SuggestedWords.Builder builder = new SuggestedWords.Builder()
|
||||||
.addWords(puncOutputTextList, null)
|
.addWords(puncOutputTextList)
|
||||||
.setIsPunctuationSuggestions();
|
.setIsPunctuationSuggestions();
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,7 +291,8 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
|
|
||||||
StringUtils.removeDupes(mSuggestions);
|
StringUtils.removeDupes(mSuggestions);
|
||||||
|
|
||||||
return new SuggestedWords.Builder().addWords(mSuggestions, null)
|
return new SuggestedWords.Builder()
|
||||||
|
.addWords(SuggestedWords.Builder.getFromCharSequenceList(mSuggestions))
|
||||||
.setAllowsToBeAutoCorrected(false)
|
.setAllowsToBeAutoCorrected(false)
|
||||||
.setHasAutoCorrection(false);
|
.setHasAutoCorrection(false);
|
||||||
}
|
}
|
||||||
|
@ -445,11 +446,12 @@ 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().addWords(mSuggestions, scoreInfoList)
|
builder = new SuggestedWords.Builder().addWords(scoreInfoList)
|
||||||
.setAllowsToBeAutoCorrected(allowsToBeAutoCorrected)
|
.setAllowsToBeAutoCorrected(allowsToBeAutoCorrected)
|
||||||
.setHasAutoCorrection(hasAutoCorrection);
|
.setHasAutoCorrection(hasAutoCorrection);
|
||||||
} else {
|
} else {
|
||||||
builder = new SuggestedWords.Builder().addWords(mSuggestions, null)
|
builder = new SuggestedWords.Builder()
|
||||||
|
.addWords(SuggestedWords.Builder.getFromCharSequenceList(mSuggestions))
|
||||||
.setAllowsToBeAutoCorrected(allowsToBeAutoCorrected)
|
.setAllowsToBeAutoCorrected(allowsToBeAutoCorrected)
|
||||||
.setHasAutoCorrection(hasAutoCorrection);
|
.setHasAutoCorrection(hasAutoCorrection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,19 +87,17 @@ public class SuggestedWords {
|
||||||
// Nothing to do here.
|
// Nothing to do here.
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder addWords(List<CharSequence> words,
|
// TODO: the following method is a wrapper to satisfy tests. Update tests and remove it.
|
||||||
List<SuggestedWordInfo> suggestedWordInfoList) {
|
public Builder addWords(final List<CharSequence> words,
|
||||||
final int N = words.size();
|
final List<SuggestedWordInfo> suggestedWordInfoList) {
|
||||||
|
return addWords(suggestedWordInfoList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder addWords(List<SuggestedWordInfo> suggestedWordInfoList) {
|
||||||
|
final int N = suggestedWordInfoList.size();
|
||||||
for (int i = 0; i < N; ++i) {
|
for (int i = 0; i < N; ++i) {
|
||||||
final CharSequence word = words.get(i);
|
SuggestedWordInfo suggestedWordInfo = suggestedWordInfoList.get(i);
|
||||||
SuggestedWordInfo suggestedWordInfo = null;
|
addWord(suggestedWordInfo.mWord, suggestedWordInfo);
|
||||||
if (suggestedWordInfoList != null) {
|
|
||||||
suggestedWordInfo = suggestedWordInfoList.get(i);
|
|
||||||
}
|
|
||||||
if (suggestedWordInfo == null) {
|
|
||||||
suggestedWordInfo = new SuggestedWordInfo(word);
|
|
||||||
}
|
|
||||||
addWord(word, suggestedWordInfo);
|
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -113,11 +111,20 @@ public class SuggestedWords {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<CharSequence> getFromApplicationSpecifiedCompletions(
|
public static List<SuggestedWordInfo> getFromCharSequenceList(
|
||||||
|
final List<CharSequence> wordList) {
|
||||||
|
final ArrayList<SuggestedWordInfo> result = new ArrayList<SuggestedWordInfo>();
|
||||||
|
for (CharSequence word : wordList) {
|
||||||
|
if (null != word) result.add(new SuggestedWordInfo(word, null, false));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<SuggestedWordInfo> getFromApplicationSpecifiedCompletions(
|
||||||
final CompletionInfo[] infos) {
|
final CompletionInfo[] infos) {
|
||||||
final ArrayList<CharSequence> result = new ArrayList<CharSequence>();
|
final ArrayList<SuggestedWordInfo> result = new ArrayList<SuggestedWordInfo>();
|
||||||
for (CompletionInfo info : infos) {
|
for (CompletionInfo info : infos) {
|
||||||
if (null != info) result.add(info.getText());
|
if (null != info) result.add(new SuggestedWordInfo(info.getText(), null, false));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue