aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-11-27 03:01:44 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-27 03:01:46 +0000
commit2ffcad113a19bb1c33a9d2cc796d3b3d7f2b8316 (patch)
tree9810e5083433945393216255b653fb2056e53301 /java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java
parentb5a7ece02bc4619f4163a83f5534905aa0a01c73 (diff)
parenta414b81a6c69e89ce36c3756560062af84af4027 (diff)
downloadlatinime-2ffcad113a19bb1c33a9d2cc796d3b3d7f2b8316.tar.gz
latinime-2ffcad113a19bb1c33a9d2cc796d3b3d7f2b8316.tar.xz
latinime-2ffcad113a19bb1c33a9d2cc796d3b3d7f2b8316.zip
Merge "Remove unused code from DictionaryFactory"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java')
-rw-r--r--java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java b/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java
index 81c3e3c61..71d724d74 100644
--- a/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java
@@ -230,6 +230,17 @@ public class DictionaryInfoUtils {
}
/**
+ * Find out whether a dictionary is available for this locale.
+ * @param context the context on which to check resources.
+ * @param locale the locale to check for.
+ * @return whether a (non-placeholder) dictionary is available or not.
+ */
+ public static boolean isDictionaryAvailable(final Context context, final Locale locale) {
+ final Resources res = context.getResources();
+ return 0 != getMainDictionaryResourceIdIfAvailableForLocale(res, locale);
+ }
+
+ /**
* Helper method to return a dictionary res id for a locale, or 0 if none.
* @param res resources for the app
* @param locale dictionary locale