diff options
author | 2011-05-11 15:19:24 +0900 | |
---|---|---|
committer | 2011-05-12 20:26:24 +0900 | |
commit | f733074aaecdfd6e89cfee2daff8a9c1233b60f1 (patch) | |
tree | cb9e90c71c874bfb2bc098f5420f689354555f1b /java/src/com/android/inputmethod/latin/DictionaryFactory.java | |
parent | 4f3b59711f6985d39e0cc908d2431ae6715d9b26 (diff) | |
download | latinime-f733074aaecdfd6e89cfee2daff8a9c1233b60f1.tar.gz latinime-f733074aaecdfd6e89cfee2daff8a9c1233b60f1.tar.xz latinime-f733074aaecdfd6e89cfee2daff8a9c1233b60f1.zip |
Fix the available input locales and moved Recorrection
Bug: 4409091
Change-Id: I6efd23ebb9528bf1bd35320057a0ea264c187451
Diffstat (limited to 'java/src/com/android/inputmethod/latin/DictionaryFactory.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/DictionaryFactory.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/DictionaryFactory.java b/java/src/com/android/inputmethod/latin/DictionaryFactory.java index 605676d70..bba331868 100644 --- a/java/src/com/android/inputmethod/latin/DictionaryFactory.java +++ b/java/src/com/android/inputmethod/latin/DictionaryFactory.java @@ -142,6 +142,25 @@ public class DictionaryFactory { return hasDictionary; } + // TODO: Do not use the size of the dictionary as an unique dictionary ID. + public static Long getDictionaryId(Context context, Locale locale) { + final Resources res = context.getResources(); + final Locale saveLocale = Utils.setSystemLocale(res, locale); + + final int resourceId = Utils.getMainDictionaryResourceId(res); + final AssetFileDescriptor afd = res.openRawResourceFd(resourceId); + final Long size = (afd != null && afd.getLength() > PLACEHOLDER_LENGTH) + ? afd.getLength() + : null; + try { + if (null != afd) afd.close(); + } catch (java.io.IOException e) { + } + + Utils.setSystemLocale(res, saveLocale); + return size; + } + // TODO: Find the Right Way to find out whether the resource is a placeholder or not. // Suggestion : strip the locale, open the placeholder file and store its offset. // Upon opening the file, if it's the same offset, then it's the placeholder. |