diff options
author | 2012-05-21 14:10:54 -0700 | |
---|---|---|
committer | 2012-05-21 14:10:54 -0700 | |
commit | cfec078d8b567362bd6d04f8e5957826a06a7feb (patch) | |
tree | 58a98e880fe3f18f1930a9b4aab178a41b5ef2ed /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | f26b0d5621c18053e7ff211df1bfa1c244596a9c (diff) | |
parent | 4bdb2bf3b9cceb99736a736de42088fcf3bd1a0f (diff) | |
download | latinime-cfec078d8b567362bd6d04f8e5957826a06a7feb.tar.gz latinime-cfec078d8b567362bd6d04f8e5957826a06a7feb.tar.xz latinime-cfec078d8b567362bd6d04f8e5957826a06a7feb.zip |
am 4bdb2bf3: am e1128687: Merge "Change to a binary version of the expandable user dictionary." into jb-dev
* commit '4bdb2bf3b9cceb99736a736de42088fcf3bd1a0f':
Change to a binary version of the expandable user dictionary.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index c5eb2c69d..71cb23167 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -106,6 +106,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen /** Whether to use the binary version of the contacts dictionary */ public static final boolean USE_BINARY_CONTACTS_DICTIONARY = true; + /** Whether to use the binary version of the user dictionary */ + public static final boolean USE_BINARY_USER_DICTIONARY = true; + // TODO: migrate this to SettingsValues private int mSuggestionVisibility; private static final int SUGGESTION_VISIBILILTY_SHOW_VALUE @@ -158,7 +161,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen private boolean mShouldSwitchToLastSubtype = true; private boolean mIsMainDictionaryAvailable; - private UserDictionary mUserDictionary; + // TODO: revert this back to the concrete class after transition. + private Dictionary mUserDictionary; private UserHistoryDictionary mUserHistoryDictionary; private boolean mIsUserDictionaryAvailable; @@ -476,9 +480,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mIsMainDictionaryAvailable = DictionaryFactory.isDictionaryAvailable(this, subtypeLocale); - mUserDictionary = new UserDictionary(this, localeStr); + if (USE_BINARY_USER_DICTIONARY) { + mUserDictionary = new UserBinaryDictionary(this, localeStr); + mIsUserDictionaryAvailable = ((UserBinaryDictionary)mUserDictionary).isEnabled(); + } else { + mUserDictionary = new UserDictionary(this, localeStr); + mIsUserDictionaryAvailable = ((UserDictionary)mUserDictionary).isEnabled(); + } mSuggest.setUserDictionary(mUserDictionary); - mIsUserDictionaryAvailable = mUserDictionary.isEnabled(); resetContactsDictionary(oldContactsDictionary); @@ -1132,7 +1141,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen @Override public boolean addWordToDictionary(String word) { - mUserDictionary.addWordToUserDictionary(word, 128); + if (USE_BINARY_USER_DICTIONARY) { + ((UserBinaryDictionary)mUserDictionary).addWordToUserDictionary(word, 128); + } else { + ((UserDictionary)mUserDictionary).addWordToUserDictionary(word, 128); + } // Suggestion strip should be updated after the operation of adding word to the // user dictionary mHandler.postUpdateSuggestions(); |