aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-08-23 17:55:46 +0900
committerJean Chalard <jchalard@google.com>2011-08-23 17:55:46 +0900
commit0ee3b694833df5488900f521adbd818a6a2e90a5 (patch)
tree5a942551ef781a1d7484ee11cef2899271b673ef /java/src
parent2d306a225c4a9c0ea7b78a022c9dcc986ddffa46 (diff)
downloadlatinime-0ee3b694833df5488900f521adbd818a6a2e90a5.tar.gz
latinime-0ee3b694833df5488900f521adbd818a6a2e90a5.tar.xz
latinime-0ee3b694833df5488900f521adbd818a6a2e90a5.zip
Fix an excessive fallback problem.
LatinIME has several fallbacks to ensure a dictionary is used. However, it should now be possible to deactivate the main dictionary through the dictionary pack settings. In this case, Latin IME should not fallback to the built-in dictionary. Change-Id: Ibd992ad89793169f04a968b40781fce819b87b6f
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/DictionaryFactory.java22
1 files changed, 4 insertions, 18 deletions
diff --git a/java/src/com/android/inputmethod/latin/DictionaryFactory.java b/java/src/com/android/inputmethod/latin/DictionaryFactory.java
index ffd204dac..9642151d7 100644
--- a/java/src/com/android/inputmethod/latin/DictionaryFactory.java
+++ b/java/src/com/android/inputmethod/latin/DictionaryFactory.java
@@ -64,24 +64,10 @@ public class DictionaryFactory {
}
}
- // null == dictList is not supposed to be possible, but better safe than sorry and it's
- // safer for future extension. In this case, rather than returning null, it should be safer
- // to return an empty DictionaryCollection.
- if (null == dictList) {
- return new DictionaryCollection();
- } else {
- if (dictList.isEmpty()) {
- // The list may be empty if no dictionaries have been added. The getter should not
- // return an empty list, but if it does we end up here. Likewise, if the files
- // we found could not be opened by the native code for any reason (format mismatch,
- // file too big to fit in memory, etc) then we could have an empty list. In this
- // case we want to fall back on the resource.
- return new DictionaryCollection(createBinaryDictionary(context, fallbackResId,
- locale));
- } else {
- return new DictionaryCollection(dictList);
- }
- }
+ // If the list is empty, that means we should not use any dictionary (for example, the user
+ // explicitly disabled the main dictionary), so the following is okay. dictList is never
+ // null, but if for some reason it is, DictionaryCollection handles it gracefully.
+ return new DictionaryCollection(dictList);
}
/**