diff options
author | 2012-04-13 18:30:19 -0700 | |
---|---|---|
committer | 2012-04-13 18:30:19 -0700 | |
commit | a7352c8df48476ead4a469c89e2d976241e25589 (patch) | |
tree | 0cdcffb31cad8d047d8c99962a2f0f4875d67bb6 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | b9315e9a85d124be5363a292e62b3842eb632d7f (diff) | |
parent | 18222f8c863e509538857b1fafca9c696fae2f55 (diff) | |
download | latinime-a7352c8df48476ead4a469c89e2d976241e25589.tar.gz latinime-a7352c8df48476ead4a469c89e2d976241e25589.tar.xz latinime-a7352c8df48476ead4a469c89e2d976241e25589.zip |
Merge "Add a new binary contacts dictionary based on ExpandableBinaryDictionary and use locale for bigrams."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 336929229..caa7f9312 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -140,6 +140,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen */ private static final String SCHEME_PACKAGE = "package"; + /** Whether to use the binary version of the contacts dictionary */ + public static final boolean USE_BINARY_CONTACTS_DICTIONARY = true; + // TODO: migrate this to SettingsValues private int mSuggestionVisibility; private static final int SUGGESTION_VISIBILILTY_SHOW_VALUE @@ -497,14 +500,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen final String localeStr = mSubtypeSwitcher.getInputLocaleStr(); final Locale keyboardLocale = mSubtypeSwitcher.getInputLocale(); - final ContactsDictionary oldContactsDictionary; + final Dictionary oldContactsDictionary; if (mSuggest != null) { oldContactsDictionary = mSuggest.getContactsDictionary(); mSuggest.close(); } else { oldContactsDictionary = null; } - mSuggest = new Suggest(this, keyboardLocale); if (mSettingsValues.mAutoCorrectEnabled) { mSuggest.setAutoCorrectionThreshold(mSettingsValues.mAutoCorrectionThreshold); @@ -530,10 +532,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen * * @param oldContactsDictionary an optional dictionary to use, or null */ - private void resetContactsDictionary(final ContactsDictionary oldContactsDictionary) { + private void resetContactsDictionary(final Dictionary oldContactsDictionary) { final boolean shouldSetDictionary = (null != mSuggest && mSettingsValues.mUseContactsDict); - final ContactsDictionary dictionaryToUse; + final Dictionary dictionaryToUse; if (!shouldSetDictionary) { // Make sure the dictionary is closed. If it is already closed, this is a no-op, // so it's safe to call it anyways. @@ -542,10 +544,19 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } else if (null != oldContactsDictionary) { // Make sure the old contacts dictionary is opened. If it is already open, this is a // no-op, so it's safe to call it anyways. - oldContactsDictionary.reopen(this); + if (USE_BINARY_CONTACTS_DICTIONARY) { + ((ContactsBinaryDictionary)oldContactsDictionary).reopen(this); + } else { + ((ContactsDictionary)oldContactsDictionary).reopen(this); + } dictionaryToUse = oldContactsDictionary; } else { - dictionaryToUse = new ContactsDictionary(this, Suggest.DIC_CONTACTS); + if (USE_BINARY_CONTACTS_DICTIONARY) { + dictionaryToUse = new ContactsBinaryDictionary(this, Suggest.DIC_CONTACTS, + mSubtypeSwitcher.getInputLocale()); + } else { + dictionaryToUse = new ContactsDictionary(this, Suggest.DIC_CONTACTS); + } } if (null != mSuggest) { |