aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-10-07 05:46:44 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-10-07 05:46:44 -0700
commit91b03b5bd77cb6f379f40dfb9a14654a893a8d78 (patch)
treebf0bea9a96ababac0c2720c51d2de58cf5fa3f58 /java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
parentf6d4efe4ac58666ea4e6165084ef1369a8e0e1af (diff)
parentfee149abe0358ff0efcebff3d0b60d8be83af437 (diff)
downloadlatinime-91b03b5bd77cb6f379f40dfb9a14654a893a8d78.tar.gz
latinime-91b03b5bd77cb6f379f40dfb9a14654a893a8d78.tar.xz
latinime-91b03b5bd77cb6f379f40dfb9a14654a893a8d78.zip
am fee149ab: Use the whitelist as a dictionary in the spell checker.
* commit 'fee149abe0358ff0efcebff3d0b60d8be83af437': Use the whitelist as a dictionary in the spell checker.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java')
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index 4d569b808..f9e6a5e68 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -37,6 +37,7 @@ import com.android.inputmethod.latin.LocaleUtils;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SynchronouslyLoadedUserDictionary;
import com.android.inputmethod.latin.Utils;
+import com.android.inputmethod.latin.WhitelistDictionary;
import com.android.inputmethod.latin.WordComposer;
import java.util.ArrayList;
@@ -79,6 +80,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
Collections.synchronizedMap(new TreeMap<String, DictionaryPool>());
private Map<String, Dictionary> mUserDictionaries =
Collections.synchronizedMap(new TreeMap<String, Dictionary>());
+ private Map<String, Dictionary> mWhitelistDictionaries =
+ Collections.synchronizedMap(new TreeMap<String, Dictionary>());
// The threshold for a candidate to be offered as a suggestion.
private double mSuggestionThreshold;
@@ -253,12 +256,17 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
mDictionaryPools = Collections.synchronizedMap(new TreeMap<String, DictionaryPool>());
final Map<String, Dictionary> oldUserDictionaries = mUserDictionaries;
mUserDictionaries = Collections.synchronizedMap(new TreeMap<String, Dictionary>());
+ final Map<String, Dictionary> oldWhitelistDictionaries = mWhitelistDictionaries;
+ mWhitelistDictionaries = Collections.synchronizedMap(new TreeMap<String, Dictionary>());
for (DictionaryPool pool : oldPools.values()) {
pool.close();
}
for (Dictionary dict : oldUserDictionaries.values()) {
dict.close();
}
+ for (Dictionary dict : oldWhitelistDictionaries.values()) {
+ dict.close();
+ }
return false;
}
@@ -280,12 +288,18 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
DictionaryFactory.createDictionaryFromManager(this, locale, fallbackResourceId,
USE_FULL_EDIT_DISTANCE_FLAG_ARRAY);
final String localeStr = locale.toString();
- Dictionary userDict = mUserDictionaries.get(localeStr);
- if (null == userDict) {
- userDict = new SynchronouslyLoadedUserDictionary(this, localeStr, true);
- mUserDictionaries.put(localeStr, userDict);
+ Dictionary userDictionary = mUserDictionaries.get(localeStr);
+ if (null == userDictionary) {
+ userDictionary = new SynchronouslyLoadedUserDictionary(this, localeStr, true);
+ mUserDictionaries.put(localeStr, userDictionary);
+ }
+ dictionaryCollection.addDictionary(userDictionary);
+ Dictionary whitelistDictionary = mWhitelistDictionaries.get(localeStr);
+ if (null == whitelistDictionary) {
+ whitelistDictionary = new WhitelistDictionary(this, locale);
+ mWhitelistDictionaries.put(localeStr, whitelistDictionary);
}
- dictionaryCollection.addDictionary(userDict);
+ dictionaryCollection.addDictionary(whitelistDictionary);
return new DictAndProximity(dictionaryCollection, proximityInfo);
}