Remove a now-useless flag.
This has been moved to the SuggestedWords object and is now represented by a single flag instead of a flag in each suggestion. Change-Id: I6e9a7cff5a7701de7e61b4de13baac25c9a87b1b
This commit is contained in:
parent
4f6cf258fe
commit
3187ba5dfe
2 changed files with 8 additions and 17 deletions
|
@ -429,7 +429,7 @@ public class Suggest implements Dictionary.WordCallback {
|
|||
final int suggestionsSize = suggestions.size();
|
||||
final ArrayList<SuggestedWordInfo> suggestionsList =
|
||||
new ArrayList<SuggestedWordInfo>(suggestionsSize);
|
||||
suggestionsList.add(new SuggestedWordInfo(autoCorrectionSuggestion, "+", false));
|
||||
suggestionsList.add(new SuggestedWordInfo(autoCorrectionSuggestion, "+"));
|
||||
// Note: i here is the index in mScores[], but the index in mSuggestions is one more
|
||||
// than i because we added the typed word to mSuggestions without touching mScores.
|
||||
for (int i = 0; i < scores.length && i < suggestionsSize - 1; ++i) {
|
||||
|
@ -440,11 +440,10 @@ public class Suggest implements Dictionary.WordCallback {
|
|||
} else {
|
||||
scoreInfoString = Integer.toString(scores[i]);
|
||||
}
|
||||
suggestionsList.add(new SuggestedWordInfo(suggestions.get(i + 1),
|
||||
scoreInfoString, false));
|
||||
suggestionsList.add(new SuggestedWordInfo(suggestions.get(i + 1), scoreInfoString));
|
||||
}
|
||||
for (int i = scores.length; i < suggestionsSize; ++i) {
|
||||
suggestionsList.add(new SuggestedWordInfo(suggestions.get(i), "--", false));
|
||||
suggestionsList.add(new SuggestedWordInfo(suggestions.get(i), "--"));
|
||||
}
|
||||
return suggestionsList;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public class SuggestedWords {
|
|||
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));
|
||||
if (null != word) result.add(new SuggestedWordInfo(word, null));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class SuggestedWords {
|
|||
final CompletionInfo[] infos) {
|
||||
final ArrayList<SuggestedWordInfo> result = new ArrayList<SuggestedWordInfo>();
|
||||
for (CompletionInfo info : infos) {
|
||||
if (null != info) result.add(new SuggestedWordInfo(info.getText(), null, false));
|
||||
if (null != info) result.add(new SuggestedWordInfo(info.getText(), null));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -105,14 +105,14 @@ public class SuggestedWords {
|
|||
final CharSequence typedWord, final SuggestedWords previousSuggestions) {
|
||||
final ArrayList<SuggestedWordInfo> suggestionsList = new ArrayList<SuggestedWordInfo>();
|
||||
final HashSet<String> alreadySeen = new HashSet<String>();
|
||||
suggestionsList.add(new SuggestedWordInfo(typedWord, null, false));
|
||||
suggestionsList.add(new SuggestedWordInfo(typedWord, null));
|
||||
alreadySeen.add(typedWord.toString());
|
||||
final int previousSize = previousSuggestions.size();
|
||||
for (int pos = 1; pos < previousSize; pos++) {
|
||||
final String prevWord = previousSuggestions.getWord(pos).toString();
|
||||
// Filter out duplicate suggestion.
|
||||
if (!alreadySeen.contains(prevWord)) {
|
||||
suggestionsList.add(new SuggestedWordInfo(prevWord, null, true));
|
||||
suggestionsList.add(new SuggestedWordInfo(prevWord, null));
|
||||
alreadySeen.add(prevWord);
|
||||
}
|
||||
}
|
||||
|
@ -122,19 +122,15 @@ public class SuggestedWords {
|
|||
public static class SuggestedWordInfo {
|
||||
public final CharSequence mWord;
|
||||
private final CharSequence mDebugString;
|
||||
private final boolean mPreviousSuggestedWord;
|
||||
|
||||
public SuggestedWordInfo(final CharSequence word) {
|
||||
mWord = word;
|
||||
mDebugString = "";
|
||||
mPreviousSuggestedWord = false;
|
||||
}
|
||||
|
||||
public SuggestedWordInfo(final CharSequence word, final CharSequence debugString,
|
||||
final boolean previousSuggestedWord) {
|
||||
public SuggestedWordInfo(final CharSequence word, final CharSequence debugString) {
|
||||
mWord = word;
|
||||
mDebugString = debugString;
|
||||
mPreviousSuggestedWord = previousSuggestedWord;
|
||||
}
|
||||
|
||||
public String getDebugString() {
|
||||
|
@ -145,10 +141,6 @@ public class SuggestedWords {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isObsoleteSuggestedWord () {
|
||||
return mPreviousSuggestedWord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (TextUtils.isEmpty(mDebugString)) {
|
||||
|
|
Loading…
Reference in a new issue