diff options
author | 2013-07-01 07:16:15 +0000 | |
---|---|---|
committer | 2013-07-01 07:16:15 +0000 | |
commit | 109ba3ace3815a7650a9fb0485b187968ddf8c29 (patch) | |
tree | 0f14c53dbd6b031d43c2534dbf3843a86b6000ba /java/src/com/android/inputmethod/latin | |
parent | 70ee2201a09af63f9fc87b408cc9b48c25a39605 (diff) | |
parent | a62b5b22eff2c1842fe1e0a4ea949e1e004de40b (diff) | |
download | latinime-109ba3ace3815a7650a9fb0485b187968ddf8c29.tar.gz latinime-109ba3ace3815a7650a9fb0485b187968ddf8c29.tar.xz latinime-109ba3ace3815a7650a9fb0485b187968ddf8c29.zip |
Merge "Regenerate old version dictionaries using new format."
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r-- | java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java | 10 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java | 9 |
2 files changed, 11 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java index 51dc85295..31a892e19 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java @@ -224,14 +224,10 @@ final public class BinaryDictionaryGetter { } } - // ## HACK ## we prevent usage of a dictionary before version 18 for English only. The reason - // for this is, since those do not include whitelist entries, the new code with an old version - // of the dictionary would lose whitelist functionality. + // ## HACK ## we prevent usage of a dictionary before version 18. The reason for this is, since + // those do not include whitelist entries, the new code with an old version of the dictionary + // would lose whitelist functionality. private static boolean hackCanUseDictionaryFile(final Locale locale, final File f) { - // Only for English - other languages didn't have a whitelist, hence this - // ad-hoc ## HACK ## - if (!Locale.ENGLISH.getLanguage().equals(locale.getLanguage())) return true; - FileInputStream inStream = null; try { // Read the version of the file diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index 9cdb86c2d..a19363d54 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -92,7 +92,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { /** Controls access to the local binary dictionary for this instance. */ private final DictionaryController mLocalDictionaryController = new DictionaryController(); - private static final int BINARY_DICT_VERSION = 1; + // TODO: Regenerate version 3 binary dictionary. + private static final int BINARY_DICT_VERSION = 2; private static final FormatSpec.FormatOptions FORMAT_OPTIONS = new FormatSpec.FormatOptions(BINARY_DICT_VERSION); @@ -415,6 +416,12 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { // shared dictionary. loadBinaryDictionary(); } + if (mBinaryDictionary != null && !mBinaryDictionary.isValidDictionary()) { + // Binary dictionary is not valid. Regenerate the dictionary file. + mSharedDictionaryController.mLastUpdateTime = time; + generateBinaryDictionary(); + loadBinaryDictionary(); + } mLocalDictionaryController.mLastUpdateTime = time; } finally { mSharedDictionaryController.unlock(); |