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 17:07:02 +0900
committerTadashi G. Takaoka <takaoka@google.com>2012-03-08 20:30:38 +0900
commitcc8c8b99bd0463f5977dea82f5e2379ea1dd4e73 (patch)
tree51098aa01dc63b0629a674a8adace0ea5b1ef064 /java/src/com/android/inputmethod/latin/DictionaryFactory.java
parent3e2d385810ca5a36a21dc6af661381c1ca27cc86 (diff)
downloadlatinime-cc8c8b99bd0463f5977dea82f5e2379ea1dd4e73.tar.gz
latinime-cc8c8b99bd0463f5977dea82f5e2379ea1dd4e73.tar.xz
latinime-cc8c8b99bd0463f5977dea82f5e2379ea1dd4e73.zip
Split Utils class to StringUtils, SubtypeUtils, and JniUtils
Change-Id: I09e91675fe7d573dad8c933ad513b21d7e409144
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);
+ }
}