Loading java/src/com/android/inputmethod/latin/LatinIME.java +8 −6 Original line number Diff line number Diff line Loading @@ -529,7 +529,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar resetContactsDictionary(oldContactsDictionary); mUserHistoryDictionary = new UserHistoryDictionary(this, this, localeStr, Suggest.DIC_USER_HISTORY); = new UserHistoryDictionary(this, localeStr, Suggest.DIC_USER_HISTORY); mSuggest.setUserHistoryDictionary(mUserHistoryDictionary); LocaleUtils.setSystemLocale(res, savedLocale); Loading Loading @@ -2009,8 +2009,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } else { prevWord = null; } final String secondWord; if (mWordComposer.isAutoCapitalized() && !mWordComposer.isMostlyCaps()) { secondWord = suggestion.toString().toLowerCase(mSubtypeSwitcher.getInputLocale()); } else { secondWord = suggestion.toString(); } mUserHistoryDictionary.addToUserHistory(null == prevWord ? null : prevWord.toString(), suggestion.toString()); secondWord); } } Loading Loading @@ -2251,10 +2257,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mFeedbackManager.vibrate(mKeyboardSwitcher.getKeyboardView()); } public boolean isAutoCapitalized() { return mWordComposer.isAutoCapitalized(); } private void updateCorrectionMode() { // TODO: cleanup messy flags final boolean shouldAutoCorrect = mSettingsValues.mAutoCorrectEnabled Loading java/src/com/android/inputmethod/latin/UserHistoryDictionary.java +1 −8 Original line number Diff line number Diff line Loading @@ -75,8 +75,6 @@ public class UserHistoryDictionary extends ExpandableDictionary { private static final String FREQ_COLUMN_PAIR_ID = "pair_id"; private static final String FREQ_COLUMN_FREQUENCY = "freq"; private final LatinIME mIme; /** Locale for which this auto dictionary is storing words */ private String mLocale; Loading Loading @@ -139,9 +137,8 @@ public class UserHistoryDictionary extends ExpandableDictionary { sDeleteHistoryBigrams = deleteHistoryBigram; } public UserHistoryDictionary(Context context, LatinIME ime, String locale, int dicTypeId) { public UserHistoryDictionary(final Context context, final String locale, final int dicTypeId) { super(context, dicTypeId); mIme = ime; mLocale = locale; if (sOpenHelper == null) { sOpenHelper = new DatabaseHelper(getContext()); Loading Loading @@ -179,10 +176,6 @@ public class UserHistoryDictionary extends ExpandableDictionary { * The second word may not be null (a NullPointerException would be thrown). */ public int addToUserHistory(final String word1, String word2) { // remove caps if second word is autocapitalized if (mIme != null && mIme.isAutoCapitalized()) { word2 = Character.toLowerCase(word2.charAt(0)) + word2.substring(1); } super.addWord(word2, FREQUENCY_FOR_TYPED); // Do not insert a word as a bigram of itself if (word2.equals(word1)) { Loading Loading
java/src/com/android/inputmethod/latin/LatinIME.java +8 −6 Original line number Diff line number Diff line Loading @@ -529,7 +529,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar resetContactsDictionary(oldContactsDictionary); mUserHistoryDictionary = new UserHistoryDictionary(this, this, localeStr, Suggest.DIC_USER_HISTORY); = new UserHistoryDictionary(this, localeStr, Suggest.DIC_USER_HISTORY); mSuggest.setUserHistoryDictionary(mUserHistoryDictionary); LocaleUtils.setSystemLocale(res, savedLocale); Loading Loading @@ -2009,8 +2009,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } else { prevWord = null; } final String secondWord; if (mWordComposer.isAutoCapitalized() && !mWordComposer.isMostlyCaps()) { secondWord = suggestion.toString().toLowerCase(mSubtypeSwitcher.getInputLocale()); } else { secondWord = suggestion.toString(); } mUserHistoryDictionary.addToUserHistory(null == prevWord ? null : prevWord.toString(), suggestion.toString()); secondWord); } } Loading Loading @@ -2251,10 +2257,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mFeedbackManager.vibrate(mKeyboardSwitcher.getKeyboardView()); } public boolean isAutoCapitalized() { return mWordComposer.isAutoCapitalized(); } private void updateCorrectionMode() { // TODO: cleanup messy flags final boolean shouldAutoCorrect = mSettingsValues.mAutoCorrectEnabled Loading
java/src/com/android/inputmethod/latin/UserHistoryDictionary.java +1 −8 Original line number Diff line number Diff line Loading @@ -75,8 +75,6 @@ public class UserHistoryDictionary extends ExpandableDictionary { private static final String FREQ_COLUMN_PAIR_ID = "pair_id"; private static final String FREQ_COLUMN_FREQUENCY = "freq"; private final LatinIME mIme; /** Locale for which this auto dictionary is storing words */ private String mLocale; Loading Loading @@ -139,9 +137,8 @@ public class UserHistoryDictionary extends ExpandableDictionary { sDeleteHistoryBigrams = deleteHistoryBigram; } public UserHistoryDictionary(Context context, LatinIME ime, String locale, int dicTypeId) { public UserHistoryDictionary(final Context context, final String locale, final int dicTypeId) { super(context, dicTypeId); mIme = ime; mLocale = locale; if (sOpenHelper == null) { sOpenHelper = new DatabaseHelper(getContext()); Loading Loading @@ -179,10 +176,6 @@ public class UserHistoryDictionary extends ExpandableDictionary { * The second word may not be null (a NullPointerException would be thrown). */ public int addToUserHistory(final String word1, String word2) { // remove caps if second word is autocapitalized if (mIme != null && mIme.isAutoCapitalized()) { word2 = Character.toLowerCase(word2.charAt(0)) + word2.substring(1); } super.addWord(word2, FREQUENCY_FOR_TYPED); // Do not insert a word as a bigram of itself if (word2.equals(word1)) { Loading