diff options
author | 2012-05-18 14:21:53 -0700 | |
---|---|---|
committer | 2012-05-18 14:21:53 -0700 | |
commit | 4bdb2bf3b9cceb99736a736de42088fcf3bd1a0f (patch) | |
tree | e9295453e64c8515fcbddabad5473e6c9e7a18b0 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | 6b11e6049dd862ffd0cf9672a084a98664f68b05 (diff) | |
parent | e1128687b101e6bda47e8dc2b8fcb5a3519a8ccf (diff) | |
download | latinime-4bdb2bf3b9cceb99736a736de42088fcf3bd1a0f.tar.gz latinime-4bdb2bf3b9cceb99736a736de42088fcf3bd1a0f.tar.xz latinime-4bdb2bf3b9cceb99736a736de42088fcf3bd1a0f.zip |
am e1128687: Merge "Change to a binary version of the expandable user dictionary." into jb-dev
* commit 'e1128687b101e6bda47e8dc2b8fcb5a3519a8ccf':
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 b632d34bf..113941de3 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); @@ -1123,7 +1132,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(); |