aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorsatok <satok@google.com>2010-11-18 18:10:25 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-11-18 18:10:25 -0800
commit1d2d3228a393b3c562226936e3523eed4894def4 (patch)
tree2347563a8e81053139475496ce3ab5ee981f74e2 /java/src/com/android/inputmethod/latin/LatinIME.java
parent636eaf3ff383819a57fa4dcac51f838d25dd590d (diff)
parent4ab730dbd34fad323063f2ffd31ce33de746668d (diff)
downloadlatinime-1d2d3228a393b3c562226936e3523eed4894def4.tar.gz
latinime-1d2d3228a393b3c562226936e3523eed4894def4.tar.xz
latinime-1d2d3228a393b3c562226936e3523eed4894def4.zip
Merge "Add a functionarity to handle Subtype"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java28
1 files changed, 21 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 9a800ba38..295a03be3 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -462,7 +462,7 @@ public class LatinIME extends InputMethodService
private void initSuggest() {
updateAutoTextEnabled();
- String locale = mSubtypeSwitcher.getInputLanguage();
+ String locale = mSubtypeSwitcher.getInputLocaleStr();
Resources orig = getResources();
Locale savedLocale = mSubtypeSwitcher.changeSystemLocale(new Locale(locale));
@@ -519,6 +519,7 @@ public class LatinIME extends InputMethodService
@Override
public void onConfigurationChanged(Configuration conf) {
mSubtypeSwitcher.onConfigurationChanged(conf);
+ onLanguageChanged();
updateAutoTextEnabled();
// If orientation changed while predicting, commit the change
@@ -577,9 +578,11 @@ public class LatinIME extends InputMethodService
return;
}
+ SubtypeSwitcher.getInstance().updateParametersOnStartInputView();
+
if (mRefreshKeyboardRequired) {
mRefreshKeyboardRequired = false;
- toggleLanguage(true, true);
+ onLanguageChanged();
}
TextEntryState.newSession(this);
@@ -2176,8 +2179,18 @@ public class LatinIME extends InputMethodService
return mWord.isFirstCharCapitalized();
}
+ // Notify that Language has been changed and toggleLanguage will update KeyboaredID according
+ // to new Language.
+ private void onLanguageChanged() {
+ toggleLanguage(true, true);
+ }
+
+ // "reset" and "next" are used only for USE_SPACEBAR_LANGUAGE_SWITCHER.
private void toggleLanguage(boolean reset, boolean next) {
- mSubtypeSwitcher.toggleLanguage(reset, next);
+ if (SubtypeSwitcher.USE_SPACEBAR_LANGUAGE_SWITCHER) {
+ mSubtypeSwitcher.toggleLanguage(reset, next);
+ }
+ // Reload keyboard because the current language has been changed.
KeyboardSwitcher switcher = mKeyboardSwitcher;
final int mode = switcher.getKeyboardMode();
final EditorInfo attribute = getCurrentInputEditorInfo();
@@ -2249,7 +2262,7 @@ public class LatinIME extends InputMethodService
return new FieldContext(
getCurrentInputConnection(),
getCurrentInputEditorInfo(),
- mSubtypeSwitcher.getInputLanguage(),
+ mSubtypeSwitcher.getInputLocaleStr(),
mSubtypeSwitcher.getEnabledLanguages());
}
@@ -2372,7 +2385,7 @@ public class LatinIME extends InputMethodService
private void updateAutoTextEnabled() {
if (mSuggest == null) return;
mSuggest.setAutoTextEnabled(mQuickFixes
- && SubtypeSwitcher.getInstance().isSystemLocaleSameAsInputLocale());
+ && SubtypeSwitcher.getInstance().isSystemLanguageSameAsInputLanguage());
}
private void updateSuggestionVisibility(SharedPreferences prefs) {
@@ -2419,7 +2432,7 @@ public class LatinIME extends InputMethodService
sp.getBoolean(PREF_HAS_USED_VOICE_INPUT_UNSUPPORTED_LOCALE, false);
mLocaleSupportedForVoiceInput = SubtypeSwitcher.getInstance().isVoiceSupported(
- SubtypeSwitcher.getInstance().getInputLanguage());
+ SubtypeSwitcher.getInstance().getInputLocaleStr());
mAutoCorrectEnabled = isAutoCorrectEnabled(sp);
mBigramSuggestionEnabled = mAutoCorrectEnabled && isBigramSuggestionEnabled(sp);
@@ -2580,6 +2593,7 @@ public class LatinIME extends InputMethodService
@Override
public void onCurrentInputMethodSubtypeChanged(InputMethodSubtype subtype) {
- SubtypeSwitcher.getInstance().onCurrentInputMethodSubtypeChanged(subtype);
+ SubtypeSwitcher.getInstance().updateSubtype(subtype);
+ onLanguageChanged();
}
}