Merge "Optimization and typo fix"

main
Jean Chalard 2012-03-23 06:20:58 -07:00 committed by Android (Google) Code Review
commit 380ad509e6
2 changed files with 5 additions and 6 deletions

View File

@ -503,7 +503,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private void initSuggest() { private void initSuggest() {
final String localeStr = mSubtypeSwitcher.getInputLocaleStr(); final String localeStr = mSubtypeSwitcher.getInputLocaleStr();
final Locale keyboardLocale = LocaleUtils.constructLocaleFromString(localeStr); final Locale keyboardLocale = mSubtypeSwitcher.getInputLocale();
final Resources res = mResources; final Resources res = mResources;
final Locale savedLocale = LocaleUtils.setSystemLocale(res, keyboardLocale); final Locale savedLocale = LocaleUtils.setSystemLocale(res, keyboardLocale);
@ -567,8 +567,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
} }
/* package private */ void resetSuggestMainDict() { /* package private */ void resetSuggestMainDict() {
final String localeStr = mSubtypeSwitcher.getInputLocaleStr(); final Locale keyboardLocale = mSubtypeSwitcher.getInputLocale();
final Locale keyboardLocale = LocaleUtils.constructLocaleFromString(localeStr);
int mainDicResId = DictionaryFactory.getMainDictionaryResourceId(mResources); int mainDicResId = DictionaryFactory.getMainDictionaryResourceId(mResources);
mSuggest.resetMainDict(this, mainDicResId, keyboardLocale); mSuggest.resetMainDict(this, mainDicResId, keyboardLocale);
} }
@ -1995,7 +1994,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
} }
private void addToUserHistoryDictionary(final CharSequence suggestion) { private void addToUserHistoryDictionary(final CharSequence suggestion) {
if (suggestion == null || suggestion.length() < 1) return; if (TextUtils.isEmpty(suggestion)) return;
// Only auto-add to dictionary if auto-correct is ON. Otherwise we'll be // Only auto-add to dictionary if auto-correct is ON. Otherwise we'll be
// adding words in situations where the user or application really didn't // adding words in situations where the user or application really didn't

View File

@ -47,13 +47,13 @@ public class SubtypeSwitcher {
private static final String TAG = SubtypeSwitcher.class.getSimpleName(); private static final String TAG = SubtypeSwitcher.class.getSimpleName();
public static final String KEYBOARD_MODE = "keyboard"; public static final String KEYBOARD_MODE = "keyboard";
private static final char LOCALE_SEPARATER = '_'; private static final char LOCALE_SEPARATOR = '_';
private static final String VOICE_MODE = "voice"; private static final String VOICE_MODE = "voice";
private static final String SUBTYPE_EXTRAVALUE_REQUIRE_NETWORK_CONNECTIVITY = private static final String SUBTYPE_EXTRAVALUE_REQUIRE_NETWORK_CONNECTIVITY =
"requireNetworkConnectivity"; "requireNetworkConnectivity";
private final TextUtils.SimpleStringSplitter mLocaleSplitter = private final TextUtils.SimpleStringSplitter mLocaleSplitter =
new TextUtils.SimpleStringSplitter(LOCALE_SEPARATER); new TextUtils.SimpleStringSplitter(LOCALE_SEPARATOR);
private static final SubtypeSwitcher sInstance = new SubtypeSwitcher(); private static final SubtypeSwitcher sInstance = new SubtypeSwitcher();
private /* final */ LatinIME mService; private /* final */ LatinIME mService;