aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-08-05 03:55:03 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-08-05 03:55:03 +0000
commit82db6b45435ab93255d6406039be88b1d6998c2c (patch)
treee64390c823187baabbe2af8376c541ebd40a10c4 /java/src
parentd9e41aac3fdf6e81ed7f2487cd9c74c28734a5e2 (diff)
parentf1accd4f04b13f764e1ffa7c7964e4b7c41ddf4b (diff)
downloadlatinime-82db6b45435ab93255d6406039be88b1d6998c2c.tar.gz
latinime-82db6b45435ab93255d6406039be88b1d6998c2c.tar.xz
latinime-82db6b45435ab93255d6406039be88b1d6998c2c.zip
am f1accd4f: [HS1] Save some data in startInputView
* commit 'f1accd4f04b13f764e1ffa7c7964e4b7c41ddf4b': [HS1] Save some data in startInputView
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java32
1 files changed, 25 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 719aeac77..373601b52 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -752,8 +752,30 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
loadKeyboard();
}
+ /**
+ * A class that holds information to pass from onStartInputInternal to onStartInputViewInternal
+ *
+ * OnStartInput needs to reload the settings and that will prevent onStartInputViewInternal
+ * from comparing the old settings with the new ones, so we use this memory to pass the
+ * necessary information along.
+ */
+ private static class EditorChangeInfo {
+ public final boolean mIsSameInputType;
+ public final boolean mHasSameOrientation;
+ public EditorChangeInfo(final boolean isSameInputType, final boolean hasSameOrientation) {
+ mIsSameInputType = isSameInputType;
+ mHasSameOrientation = hasSameOrientation;
+ }
+ }
+
+ private EditorChangeInfo mLastEditorChangeInfo;
+
private void onStartInputInternal(final EditorInfo editorInfo, final boolean restarting) {
super.onStartInput(editorInfo, restarting);
+ SettingsValues currentSettingsValues = mSettings.getCurrent();
+ mLastEditorChangeInfo = new EditorChangeInfo(
+ currentSettingsValues.isSameInputType(editorInfo),
+ currentSettingsValues.hasSameOrientation(getResources().getConfiguration()));
}
@SuppressWarnings("deprecation")
@@ -763,9 +785,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final KeyboardSwitcher switcher = mKeyboardSwitcher;
switcher.updateKeyboardTheme();
final MainKeyboardView mainKeyboardView = switcher.getMainKeyboardView();
- // If we are starting input in a different text field from before, we'll have to reload
- // settings, so currentSettingsValues can't be final.
- SettingsValues currentSettingsValues = mSettings.getCurrent();
if (editorInfo == null) {
Log.e(TAG, "Null EditorInfo in onStartInputView()");
@@ -808,7 +827,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
accessUtils.onStartInputViewInternal(mainKeyboardView, editorInfo, restarting);
}
- final boolean inputTypeChanged = !currentSettingsValues.isSameInputType(editorInfo);
+ final boolean inputTypeChanged = !mLastEditorChangeInfo.mIsSameInputType;
final boolean isDifferentTextField = !restarting || inputTypeChanged;
if (isDifferentTextField) {
mSubtypeSwitcher.updateParametersOnStartInputView();
@@ -853,13 +872,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
canReachInputConnection = true;
}
- if (isDifferentTextField ||
- !currentSettingsValues.hasSameOrientation(getResources().getConfiguration())) {
+ if (isDifferentTextField || !mLastEditorChangeInfo.mHasSameOrientation) {
loadSettings();
}
+ final SettingsValues currentSettingsValues = mSettings.getCurrent();
if (isDifferentTextField) {
mainKeyboardView.closing();
- currentSettingsValues = mSettings.getCurrent();
if (currentSettingsValues.mAutoCorrectionEnabledPerUserSettings) {
suggest.setAutoCorrectionThreshold(