diff options
author | 2011-04-26 21:49:09 +0900 | |
---|---|---|
committer | 2011-04-27 17:06:20 +0900 | |
commit | 4250eb27f54f8fedc388fe4825b0646a88778744 (patch) | |
tree | de7b42f5aa401d2a571f60056012c93eeb5552f4 /java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java | |
parent | aa9de267322bbf3a644da728253a224acf5a2d38 (diff) | |
download | latinime-4250eb27f54f8fedc388fe4825b0646a88778744.tar.gz latinime-4250eb27f54f8fedc388fe4825b0646a88778744.tar.xz latinime-4250eb27f54f8fedc388fe4825b0646a88778744.zip |
Create a dictionary collection and a dictionary factory.
The dictionary collection is a class complying to the Dictionary
interface that acts as a front end to a collection of arbitrarily many
dictionaries of any type.
The dictionary factory is a helper class for creating various
dictionaries and get some meta information about them.
At the same time, this change makes the BinaryDictionary class
not a singleton any more.
This also needs I9afe61a9 to not break the build.
Change-Id: I61fdcc4867fcda18342807bf1865e6e46979e5d5
Diffstat (limited to 'java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java')
-rw-r--r-- | java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java b/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java index 6678082b7..a1b49b475 100644 --- a/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java +++ b/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java @@ -17,12 +17,11 @@ package com.android.inputmethod.deprecated.languageswitcher; import com.android.inputmethod.keyboard.KeyboardParser; -import com.android.inputmethod.latin.BinaryDictionary; +import com.android.inputmethod.latin.DictionaryFactory; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.Settings; import com.android.inputmethod.latin.SharedPreferencesCompat; import com.android.inputmethod.latin.SubtypeSwitcher; -import com.android.inputmethod.latin.Suggest; import com.android.inputmethod.latin.Utils; import org.xmlpull.v1.XmlPullParserException; @@ -123,20 +122,10 @@ public class InputLanguageSelection extends PreferenceActivity { if (locale == null) return new Pair<Boolean, Boolean>(false, false); final Resources res = getResources(); final Locale saveLocale = Utils.setSystemLocale(res, locale); - boolean hasDictionary = false; + final boolean hasDictionary = DictionaryFactory.isDictionaryAvailable(this, locale); boolean hasLayout = false; try { - BinaryDictionary bd = BinaryDictionary.initDictionaryFromManager(this, Suggest.DIC_MAIN, - locale, Utils.getMainDictionaryResourceId(res)); - - // Is the dictionary larger than a placeholder? Arbitrarily chose a lower limit of - // 4000-5000 words, whereas the LARGE_DICTIONARY is about 20000+ words. - if (bd.getSize() > Suggest.LARGE_DICTIONARY_THRESHOLD / 4) { - hasDictionary = true; - } - bd.close(); - final String localeStr = locale.toString(); final String[] layoutCountryCodes = KeyboardParser.parseKeyboardLocale( this, R.xml.kbd_qwerty).split(",", -1); |