diff options
author | 2011-07-27 15:32:25 -0700 | |
---|---|---|
committer | 2011-07-28 11:02:29 -0700 | |
commit | c3d175c01ff1956ddb1c2d608d69af1793b4ad8a (patch) | |
tree | d6f70ff75ac83f71c22f19307949d5fa6304afdf /java/src | |
parent | 0a5345c7b6e9282ea401a4017c2c2f9835e623b1 (diff) | |
download | latinime-c3d175c01ff1956ddb1c2d608d69af1793b4ad8a.tar.gz latinime-c3d175c01ff1956ddb1c2d608d69af1793b4ad8a.tar.xz latinime-c3d175c01ff1956ddb1c2d608d69af1793b4ad8a.zip |
Fix wrong keyboard width when orientation has changed while IME is not shown
Bug: 5084021
Change-Id: Ie42da40b8249eaf9cf29707058906949278eff6a
Diffstat (limited to 'java/src')
3 files changed, 10 insertions, 9 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java index 3f30165aa..75fba947e 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java @@ -160,7 +160,7 @@ public class KeyboardId { return other instanceof KeyboardId && equals((KeyboardId) other); } - boolean equals(KeyboardId other) { + private boolean equals(KeyboardId other) { return other.mLocale.equals(this.mLocale) && other.mOrientation == this.mOrientation && other.mWidth == this.mWidth diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index 552a3cd30..a4080f1be 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -161,24 +161,25 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha } } + public void onHideWindow() { + mWindowWidth = 0; + mIsAutoCorrectionActive = false; + } + @SuppressWarnings("unused") public void onSizeChanged(int w, int h, int oldw, int oldh) { + // TODO: This hack should be removed when display metric returns a proper width. + // Until then, the behavior of KeyboardSwitcher is suboptimal on a device that has a + // vertical system navigation bar in landscape screen orientation, for instance. final int width = mInputMethodService.getWindow().getWindow().getDecorView().getWidth(); // If the window width hasn't fixed yet or keyboard doesn't exist, nothing to do with. if (width == 0 || mCurrentId == null) return; // The window width is fixed. mWindowWidth = width; - // If this is the first time the {@link KeyboardView} has been shown, no need to reload - // keyboard. - if (oldw == 0 && oldh == 0) - return; // Reload keyboard with new width. final int orientation = mInputMethodService.getResources().getConfiguration().orientation; final KeyboardId newId = mCurrentId.cloneWithNewGeometry(orientation, width); - // If the new keyboard is the same as the current one, no need to reload it. - if (newId.equals(mCurrentId)) - return; setKeyboard(getKeyboard(newId)); } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d9d421411..ddc69f123 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -872,7 +872,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar @Override public void hideWindow() { LatinImeLogger.commit(); - mKeyboardSwitcher.onAutoCorrectionStateChanged(false); + mKeyboardSwitcher.onHideWindow(); if (TRACE) Debug.stopMethodTracing(); if (mOptionsDialog != null && mOptionsDialog.isShowing()) { |