diff options
author | 2013-12-12 20:14:06 +0900 | |
---|---|---|
committer | 2013-12-12 20:14:06 +0900 | |
commit | 9bd6dac4708ad94fd0257c53e977df62b152e20c (patch) | |
tree | 56a5652edf71dd19d04161f72e3e013608cc2a9c /java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java | |
parent | d06de553b2ac21dff9c8819eb59eda7bcba3f5e0 (diff) | |
download | latinime-9bd6dac4708ad94fd0257c53e977df62b152e20c.tar.gz latinime-9bd6dac4708ad94fd0257c53e977df62b152e20c.tar.xz latinime-9bd6dac4708ad94fd0257c53e977df62b152e20c.zip |
Add a constructor for testing to non-main dictionaries.
The new constructor is used for creating dictionary instance
that uses a given file.
Bug: 11956652
Change-Id: Ifbf420a1a768eb95a5c3a58eeb1be5936b306d35
Diffstat (limited to 'java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index ed80a9629..9f5cd162f 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -105,6 +105,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { /** Whether to support dynamically updating the dictionary */ private final boolean mIsUpdatable; + /** Dictionary file */ + private final File mDictFile; + // TODO: remove, once dynamic operations is serialized /** Controls updating the shared binary dictionary file across multiple instances. */ private final DictionaryUpdateController mDictNameDictionaryUpdateController; @@ -146,7 +149,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { } private File getDictFile() { - return new File(mContext.getFilesDir(), mDictName + DICT_FILE_EXTENSION); + return mDictFile; } /** @@ -200,11 +203,20 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { */ public ExpandableBinaryDictionary(final Context context, final String dictName, final Locale locale, final String dictType, final boolean isUpdatable) { + this(context, dictName, locale, dictType, isUpdatable, + new File(context.getFilesDir(), dictName + DICT_FILE_EXTENSION)); + } + + // Creates an instance that uses a given dictionary file. + public ExpandableBinaryDictionary(final Context context, final String dictName, + final Locale locale, final String dictType, final boolean isUpdatable, + final File dictFile) { super(dictType); mDictName = dictName; mContext = context; mLocale = locale; mIsUpdatable = isUpdatable; + mDictFile = dictFile; mBinaryDictionary = null; mDictNameDictionaryUpdateController = getDictionaryUpdateController(dictName); // Currently, only dynamic personalization dictionary is updatable. |