aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/DictionaryFactory.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-04-19 19:53:41 +0900
committerTadashi G. Takaoka <takaoka@google.com>2012-04-19 19:57:43 +0900
commitab39afca23f69f27b67b7c02353e21f769e8129d (patch)
tree5df513020c33dd3e7e21dea7cf5294a98f34456e /java/src/com/android/inputmethod/latin/DictionaryFactory.java
parent1cb08acaf3b4d58cbf4cb65f9fc3990b39e33f00 (diff)
downloadlatinime-ab39afca23f69f27b67b7c02353e21f769e8129d.tar.gz
latinime-ab39afca23f69f27b67b7c02353e21f769e8129d.tar.xz
latinime-ab39afca23f69f27b67b7c02353e21f769e8129d.zip
Remove LatinIME reference from DictionaryFactor class
Change-Id: Iad10e71baa81a1b4eb3c84ead47d658d567b8201
Diffstat (limited to 'java/src/com/android/inputmethod/latin/DictionaryFactory.java')
-rw-r--r--java/src/com/android/inputmethod/latin/DictionaryFactory.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/DictionaryFactory.java b/java/src/com/android/inputmethod/latin/DictionaryFactory.java
index 17d75368e..f5dc7b34a 100644
--- a/java/src/com/android/inputmethod/latin/DictionaryFactory.java
+++ b/java/src/com/android/inputmethod/latin/DictionaryFactory.java
@@ -30,7 +30,10 @@ import java.util.Locale;
* Factory for dictionary instances.
*/
public class DictionaryFactory {
- private static String TAG = DictionaryFactory.class.getSimpleName();
+ private static final String TAG = DictionaryFactory.class.getSimpleName();
+ // This class must be located in the same package as LatinIME.java.
+ private static final String RESOURCE_PACKAGE_NAME =
+ DictionaryFactory.class.getPackage().getName();
/**
* Initializes a dictionary from a dictionary pack, with explicit flags.
@@ -166,20 +169,19 @@ public class DictionaryFactory {
*/
private static int getMainDictionaryResourceIdIfAvailableForLocale(final Resources res,
final Locale locale) {
- final String packageName = LatinIME.class.getPackage().getName();
int resId;
-
// Try to find main_language_country dictionary.
if (!locale.getCountry().isEmpty()) {
final String dictLanguageCountry = MAIN_DICT_PREFIX + locale.toString().toLowerCase();
- if ((resId = res.getIdentifier(dictLanguageCountry, "raw", packageName)) != 0) {
+ if ((resId = res.getIdentifier(
+ dictLanguageCountry, "raw", RESOURCE_PACKAGE_NAME)) != 0) {
return resId;
}
}
// Try to find main_language dictionary.
final String dictLanguage = MAIN_DICT_PREFIX + locale.getLanguage();
- if ((resId = res.getIdentifier(dictLanguage, "raw", packageName)) != 0) {
+ if ((resId = res.getIdentifier(dictLanguage, "raw", RESOURCE_PACKAGE_NAME)) != 0) {
return resId;
}
@@ -195,7 +197,6 @@ public class DictionaryFactory {
public static int getMainDictionaryResourceId(final Resources res, final Locale locale) {
int resourceId = getMainDictionaryResourceIdIfAvailableForLocale(res, locale);
if (0 != resourceId) return resourceId;
- final String packageName = LatinIME.class.getPackage().getName();
- return res.getIdentifier(DEFAULT_MAIN_DICT, "raw", packageName);
+ return res.getIdentifier(DEFAULT_MAIN_DICT, "raw", RESOURCE_PACKAGE_NAME);
}
}