diff options
author | 2012-03-16 18:01:27 +0900 | |
---|---|---|
committer | 2012-03-19 12:03:51 +0900 | |
commit | 9ffb94fa1318f354692fab7abf4775fa14397a96 (patch) | |
tree | 51447255d15b5996897ca43b4364d724e0d92ba2 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | 660776e09b9a3b321074a94721d901a035ca1b9f (diff) | |
download | latinime-9ffb94fa1318f354692fab7abf4775fa14397a96.tar.gz latinime-9ffb94fa1318f354692fab7abf4775fa14397a96.tar.xz latinime-9ffb94fa1318f354692fab7abf4775fa14397a96.zip |
Rename the user history dictionary.
UserBigramDictionary -> UserHistoryDictionary.
Also update all methods, strings and comments, except those needed
for backward compatibility (which only include the name of the
database file).
Change-Id: I0bccea29880dc566b90100575b83baaa947b03ae
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d5cd35db6..99a4d54d8 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -202,7 +202,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private boolean mShouldSwitchToLastSubtype = true; private UserDictionary mUserDictionary; - private UserBigramDictionary mUserBigramDictionary; + private UserHistoryDictionary mUserHistoryDictionary; private boolean mIsUserDictionaryAvailable; private LastComposedWord mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD; @@ -526,11 +526,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar resetContactsDictionary(oldContactsDictionary); - // TODO: rename UserBigramDictionary into UserHistoryDictionary - mUserBigramDictionary - = new UserBigramDictionary(this, this, localeStr, Suggest.DIC_USER_BIGRAM); - mSuggest.setUserUnigramDictionary(mUserBigramDictionary); - mSuggest.setUserBigramDictionary(mUserBigramDictionary); + mUserHistoryDictionary + = new UserHistoryDictionary(this, this, localeStr, Suggest.DIC_USER_HISTORY); + mSuggest.setUserHistoryDictionary(mUserHistoryDictionary); LocaleUtils.setSystemLocale(res, savedLocale); } @@ -772,7 +770,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar KeyboardView inputView = mKeyboardSwitcher.getKeyboardView(); if (inputView != null) inputView.closing(); - if (mUserBigramDictionary != null) mUserBigramDictionary.flushPendingWrites(); + if (mUserHistoryDictionary != null) mUserHistoryDictionary.flushPendingWrites(); } private void onFinishInputViewInternal(boolean finishingInput) { @@ -1990,9 +1988,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar setSuggestionStripShown(isSuggestionsStripVisible()); } - /** - * Adds to the UserBigramDictionary and/or UserUnigramDictionary - */ private void addToUserHistoryDictionary(final CharSequence suggestion) { if (suggestion == null || suggestion.length() < 1) return; @@ -2004,16 +1999,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar return; } - if (mUserBigramDictionary != null) { - mUserBigramDictionary.addUnigram(suggestion.toString()); + if (mUserHistoryDictionary != null) { final InputConnection ic = getCurrentInputConnection(); + final CharSequence prevWord; if (null != ic) { - final CharSequence prevWord = - EditingUtils.getPreviousWord(ic, mSettingsValues.mWordSeparators); - if (null != prevWord) { - mUserBigramDictionary.addBigramPair(prevWord.toString(), suggestion.toString()); - } + prevWord = EditingUtils.getPreviousWord(ic, mSettingsValues.mWordSeparators); + } else { + prevWord = null; } + mUserHistoryDictionary.addToUserHistory(null == prevWord ? null : prevWord.toString(), + suggestion.toString()); } } |