diff options
author | 2012-03-16 16:16:02 +0900 | |
---|---|---|
committer | 2012-03-16 17:01:57 +0900 | |
commit | c68d1bbfafe4b2041db49523c044123f78d6635d (patch) | |
tree | 97166776032b5ba411c1af6dba1ec8a08acee690 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | c24f66e18007b5aba32bfab8f86eb7f03fa6c1b7 (diff) | |
download | latinime-c68d1bbfafe4b2041db49523c044123f78d6635d.tar.gz latinime-c68d1bbfafe4b2041db49523c044123f78d6635d.tar.xz latinime-c68d1bbfafe4b2041db49523c044123f78d6635d.zip |
Move the UserUnigramDictionary functionality over
UserBigramDictionary now assumes both functionalities. It will
be renamed to UserHistoryDictionary in a future change.
There are several reasons to do this. First, there is a lot of
duplicate code in User{Unigram,Bigram}Dictionaries that are
factored by the few lines of code in this change. Also, other
dictionaries like BinaryDictionary or ContactsDictionary all
assume both responsibilities, as should be the case
theoretically.
It is also possible to do this because previous versions don't
write any unigram data that we'd want to reuse. For even older
versions that do write data, we can't really make any sense out
of it. Bigram data however can be useful, and this allows us to
reuse it easily.
Change-Id: I755525f92744e1536eaef097527e8151b7859a30
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 7c08377be..234a501de 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -204,7 +204,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private UserDictionary mUserDictionary; private UserBigramDictionary mUserBigramDictionary; - private UserUnigramDictionary mUserUnigramDictionary; private boolean mIsUserDictionaryAvailable; private LastComposedWord mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD; @@ -528,12 +527,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar resetContactsDictionary(oldContactsDictionary); - mUserUnigramDictionary - = new UserUnigramDictionary(this, this, localeStr, Suggest.DIC_USER_UNIGRAM); - mSuggest.setUserUnigramDictionary(mUserUnigramDictionary); - + // TODO: rename UserBigramDictionary into UserHistoryDictionary mUserBigramDictionary = new UserBigramDictionary(this, this, localeStr, Suggest.DIC_USER_BIGRAM); + mSuggest.setUserUnigramDictionary(mUserBigramDictionary); mSuggest.setUserBigramDictionary(mUserBigramDictionary); LocaleUtils.setSystemLocale(res, savedLocale); @@ -776,7 +773,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar KeyboardView inputView = mKeyboardSwitcher.getKeyboardView(); if (inputView != null) inputView.closing(); - if (mUserUnigramDictionary != null) mUserUnigramDictionary.flushPendingWrites(); if (mUserBigramDictionary != null) mUserBigramDictionary.flushPendingWrites(); } @@ -2009,11 +2005,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar return; } - if (null != mUserUnigramDictionary) { - mUserUnigramDictionary.addUnigram(suggestion.toString()); - } - if (mUserBigramDictionary != null) { + mUserBigramDictionary.addUnigram(suggestion.toString()); final InputConnection ic = getCurrentInputConnection(); if (null != ic) { final CharSequence prevWord = |