Merge "[IL57] Don't require a main dict suggestion."
This commit is contained in:
commit
2c1a13c56c
1 changed files with 0 additions and 12 deletions
|
@ -74,7 +74,6 @@ public final class SuggestionSpanUtils {
|
||||||
return pickedWord;
|
return pickedWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasSuggestionFromMainDictionary = false;
|
|
||||||
final ArrayList<String> suggestionsList = CollectionUtils.newArrayList();
|
final ArrayList<String> suggestionsList = CollectionUtils.newArrayList();
|
||||||
for (int i = 0; i < suggestedWords.size(); ++i) {
|
for (int i = 0; i < suggestedWords.size(); ++i) {
|
||||||
if (suggestionsList.size() >= SuggestionSpan.SUGGESTIONS_MAX_SIZE) {
|
if (suggestionsList.size() >= SuggestionSpan.SUGGESTIONS_MAX_SIZE) {
|
||||||
|
@ -84,22 +83,11 @@ public final class SuggestionSpanUtils {
|
||||||
if (info.mKind == SuggestedWordInfo.KIND_PREDICTION) {
|
if (info.mKind == SuggestedWordInfo.KIND_PREDICTION) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (info.mSourceDict.mDictType == Dictionary.TYPE_MAIN) {
|
|
||||||
hasSuggestionFromMainDictionary = true;
|
|
||||||
}
|
|
||||||
final String word = suggestedWords.getWord(i);
|
final String word = suggestedWords.getWord(i);
|
||||||
if (!TextUtils.equals(pickedWord, word)) {
|
if (!TextUtils.equals(pickedWord, word)) {
|
||||||
suggestionsList.add(word.toString());
|
suggestionsList.add(word.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasSuggestionFromMainDictionary) {
|
|
||||||
// If we don't have any suggestions from the dictionary, it probably looks bad
|
|
||||||
// enough as it is already because suggestions come pretty much only from contacts.
|
|
||||||
// Let's not embed these bad suggestions in the text view so as to avoid using
|
|
||||||
// them with recorrection.
|
|
||||||
return pickedWord;
|
|
||||||
}
|
|
||||||
|
|
||||||
final SuggestionSpan suggestionSpan = new SuggestionSpan(context, null /* locale */,
|
final SuggestionSpan suggestionSpan = new SuggestionSpan(context, null /* locale */,
|
||||||
suggestionsList.toArray(new String[suggestionsList.size()]), 0 /* flags */,
|
suggestionsList.toArray(new String[suggestionsList.size()]), 0 /* flags */,
|
||||||
SuggestionSpanPickedNotificationReceiver.class);
|
SuggestionSpanPickedNotificationReceiver.class);
|
||||||
|
|
Loading…
Reference in a new issue