am cba1af9c: Fix a bug where the sequence numbers would be wrong
* commit 'cba1af9c5626a2cb1e611735deb72db72d02c4c1': Fix a bug where the sequence numbers would be wrongmain
commit
fef82761c7
|
@ -61,11 +61,6 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
|
||||||
private static final int CAPITALIZE_ALL = 2; // All caps
|
private static final int CAPITALIZE_ALL = 2; // All caps
|
||||||
|
|
||||||
private final static String[] EMPTY_STRING_ARRAY = new String[0];
|
private final static String[] EMPTY_STRING_ARRAY = new String[0];
|
||||||
private final static SuggestionsInfo NOT_IN_DICT_EMPTY_SUGGESTIONS =
|
|
||||||
new SuggestionsInfo(0, EMPTY_STRING_ARRAY);
|
|
||||||
private final static SuggestionsInfo IN_DICT_EMPTY_SUGGESTIONS =
|
|
||||||
new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY,
|
|
||||||
EMPTY_STRING_ARRAY);
|
|
||||||
private final static Flag[] USE_FULL_EDIT_DISTANCE_FLAG_ARRAY;
|
private final static Flag[] USE_FULL_EDIT_DISTANCE_FLAG_ARRAY;
|
||||||
static {
|
static {
|
||||||
// See BinaryDictionary.java for an explanation of these flags
|
// See BinaryDictionary.java for an explanation of these flags
|
||||||
|
@ -103,6 +98,15 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
|
||||||
return new AndroidSpellCheckerSession(this);
|
return new AndroidSpellCheckerSession(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static SuggestionsInfo getNotInDictEmptySuggestions() {
|
||||||
|
return new SuggestionsInfo(0, EMPTY_STRING_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SuggestionsInfo getInDictEmptySuggestions() {
|
||||||
|
return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY,
|
||||||
|
EMPTY_STRING_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
private static class SuggestionsGatherer implements WordCallback {
|
private static class SuggestionsGatherer implements WordCallback {
|
||||||
public static class Result {
|
public static class Result {
|
||||||
public final String[] mSuggestions;
|
public final String[] mSuggestions;
|
||||||
|
@ -408,9 +412,9 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
|
||||||
DictAndProximity dictInfo = null;
|
DictAndProximity dictInfo = null;
|
||||||
try {
|
try {
|
||||||
dictInfo = mDictionaryPool.takeOrGetNull();
|
dictInfo = mDictionaryPool.takeOrGetNull();
|
||||||
if (null == dictInfo) return NOT_IN_DICT_EMPTY_SUGGESTIONS;
|
if (null == dictInfo) return getNotInDictEmptySuggestions();
|
||||||
return dictInfo.mDictionary.isValidWord(text) ? IN_DICT_EMPTY_SUGGESTIONS
|
return dictInfo.mDictionary.isValidWord(text) ? getInDictEmptySuggestions()
|
||||||
: NOT_IN_DICT_EMPTY_SUGGESTIONS;
|
: getNotInDictEmptySuggestions();
|
||||||
} finally {
|
} finally {
|
||||||
if (null != dictInfo) {
|
if (null != dictInfo) {
|
||||||
if (!mDictionaryPool.offer(dictInfo)) {
|
if (!mDictionaryPool.offer(dictInfo)) {
|
||||||
|
@ -445,7 +449,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
|
||||||
DictAndProximity dictInfo = null;
|
DictAndProximity dictInfo = null;
|
||||||
try {
|
try {
|
||||||
dictInfo = mDictionaryPool.takeOrGetNull();
|
dictInfo = mDictionaryPool.takeOrGetNull();
|
||||||
if (null == dictInfo) return NOT_IN_DICT_EMPTY_SUGGESTIONS;
|
if (null == dictInfo) return getNotInDictEmptySuggestions();
|
||||||
dictInfo.mDictionary.getWords(composer, suggestionsGatherer,
|
dictInfo.mDictionary.getWords(composer, suggestionsGatherer,
|
||||||
dictInfo.mProximityInfo);
|
dictInfo.mProximityInfo);
|
||||||
isInDict = dictInfo.mDictionary.isValidWord(text);
|
isInDict = dictInfo.mDictionary.isValidWord(text);
|
||||||
|
@ -490,7 +494,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
|
||||||
throw e;
|
throw e;
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "Exception while spellcheking: " + e);
|
Log.e(TAG, "Exception while spellcheking: " + e);
|
||||||
return NOT_IN_DICT_EMPTY_SUGGESTIONS;
|
return getNotInDictEmptySuggestions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue