diff options
author | 2012-04-06 19:12:05 +0900 | |
---|---|---|
committer | 2012-04-06 19:33:01 +0900 | |
commit | 24aee9100e92dc4c06cdb54487a4922420fa8660 (patch) | |
tree | 698b855e9dbfc2f1c7106d263bb7b5e54e1807a6 /java/src/com/android/inputmethod/latin/BinaryDictionary.java | |
parent | aa8df599146e9599b872398c067a2ee27079b659 (diff) | |
download | latinime-24aee9100e92dc4c06cdb54487a4922420fa8660.tar.gz latinime-24aee9100e92dc4c06cdb54487a4922420fa8660.tar.xz latinime-24aee9100e92dc4c06cdb54487a4922420fa8660.zip |
Change the flags to a boolean in constructors.
Change-Id: I9939204f3b16346aaebd4d726315ba9c4faf910a
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/BinaryDictionary.java | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index 92019c0ed..61ecec922 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -64,7 +64,7 @@ public class BinaryDictionary extends Dictionary { // FULL_EDIT_DISTANCE is a flag that forces the dictionary to use full words // when computing edit distance, instead of the default behavior of stopping // the evaluation at the size the user typed. - public static final Flag FLAG_USE_FULL_EDIT_DISTANCE = new Flag(0x2); + public static final int FLAG_USE_FULL_EDIT_DISTANCE = 0x2; // Can create a new flag from extravalue : // public static final Flag FLAG_MYFLAG = @@ -85,7 +85,7 @@ public class BinaryDictionary extends Dictionary { FLAG_REQUIRES_FRENCH_LIGATURES_PROCESSING, }; - private int mFlags = 0; + private final int mFlags; /** * Constructor for the binary dictionary. This is supposed to be called from the @@ -95,26 +95,20 @@ public class BinaryDictionary extends Dictionary { * @param filename the name of the file to read through native code. * @param offset the offset of the dictionary data within the file. * @param length the length of the binary data. - * @param flagArray the flags to limit the dictionary to, or null for default. + * @param useFullEditDistance whether to use the full edit distance in suggestions */ public BinaryDictionary(final Context context, - final String filename, final long offset, final long length, final Flag[] flagArray, - Locale locale) { + final String filename, final long offset, final long length, + final boolean useFullEditDistance, final Locale locale) { // Note: at the moment a binary dictionary is always of the "main" type. // Initializing this here will help transitioning out of the scheme where // the Suggest class knows everything about every single dictionary. mDicTypeId = Suggest.DIC_MAIN; - // TODO: Stop relying on the state of SubtypeSwitcher, get it as a parameter - final RunInLocale<Void> job = new RunInLocale<Void>() { - @Override - protected Void job(Resources res) { - // TODO: remove this when all flags are moved to the native code - mFlags = Flag.initFlags(null == flagArray ? ALL_CONFIG_FLAGS : flagArray, context, - SubtypeSwitcher.getInstance()); - return null; - } - }; - job.runInLocale(context.getResources(), locale); + if (useFullEditDistance) { + mFlags = FLAG_USE_FULL_EDIT_DISTANCE; + } else { + mFlags = 0; + } loadDictionary(filename, offset, length); } |