aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/DictionaryFactory.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-03-08 03:59:59 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-08 03:59:59 -0800
commitf686211183885250cb3729a33a3a8924f086698f (patch)
tree2b61265bb2631dce9a81119d46c1668700573740 /java/src/com/android/inputmethod/latin/DictionaryFactory.java
parent7d6d98ecc54f2625312d65cc179b67684ab058dd (diff)
parentcc8c8b99bd0463f5977dea82f5e2379ea1dd4e73 (diff)
downloadlatinime-f686211183885250cb3729a33a3a8924f086698f.tar.gz
latinime-f686211183885250cb3729a33a3a8924f086698f.tar.xz
latinime-f686211183885250cb3729a33a3a8924f086698f.zip
Merge "Split Utils class to StringUtils, SubtypeUtils, and JniUtils"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/DictionaryFactory.java')
-rw-r--r--java/src/com/android/inputmethod/latin/DictionaryFactory.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/DictionaryFactory.java b/java/src/com/android/inputmethod/latin/DictionaryFactory.java
index 1607f86a8..7a81f7bd5 100644
--- a/java/src/com/android/inputmethod/latin/DictionaryFactory.java
+++ b/java/src/com/android/inputmethod/latin/DictionaryFactory.java
@@ -164,7 +164,7 @@ public class DictionaryFactory {
final Resources res = context.getResources();
final Locale saveLocale = LocaleUtils.setSystemLocale(res, locale);
- final int resourceId = Utils.getMainDictionaryResourceId(res);
+ final int resourceId = getMainDictionaryResourceId(res);
final AssetFileDescriptor afd = res.openRawResourceFd(resourceId);
final boolean hasDictionary = isFullDictionary(afd);
try {
@@ -182,7 +182,7 @@ public class DictionaryFactory {
final Resources res = context.getResources();
final Locale saveLocale = LocaleUtils.setSystemLocale(res, locale);
- final int resourceId = Utils.getMainDictionaryResourceId(res);
+ final int resourceId = getMainDictionaryResourceId(res);
final AssetFileDescriptor afd = res.openRawResourceFd(resourceId);
final Long size = (afd != null && afd.getLength() > PLACEHOLDER_LENGTH)
? afd.getLength()
@@ -209,4 +209,14 @@ public class DictionaryFactory {
protected static boolean isFullDictionary(final AssetFileDescriptor afd) {
return (afd != null && afd.getLength() > PLACEHOLDER_LENGTH);
}
+
+ /**
+ * Returns a main dictionary resource id
+ * @return main dictionary resource id
+ */
+ public static int getMainDictionaryResourceId(Resources res) {
+ final String MAIN_DIC_NAME = "main";
+ String packageName = LatinIME.class.getPackage().getName();
+ return res.getIdentifier(MAIN_DIC_NAME, "raw", packageName);
+ }
}