diff options
author | 2011-01-11 18:50:40 +0900 | |
---|---|---|
committer | 2011-01-12 14:13:39 +0900 | |
commit | 07a0fd0f5100a0cee978ba07751d63595c9d27ac (patch) | |
tree | ccbb36e7eded4c6741ca82e96347bde754e59eba /java/src/com/android/inputmethod/latin/LatinKeyboardView.java | |
parent | 4246861c60e6ea5a719991c8bc1c0c9461eb44d7 (diff) | |
download | latinime-07a0fd0f5100a0cee978ba07751d63595c9d27ac.tar.gz latinime-07a0fd0f5100a0cee978ba07751d63595c9d27ac.tar.xz latinime-07a0fd0f5100a0cee978ba07751d63595c9d27ac.zip |
Reset old keyboard state before switching to new keyboard (DO NOT MERGE)
Bug: 3322158
Change-Id: I8030202f9b1b491bd9b7acf5ce14b6d8f14db978
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinKeyboardView.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinKeyboardView.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java index 22d39f7aa..a5476e457 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java @@ -76,14 +76,19 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { } @Override - public void setKeyboard(Keyboard k) { - super.setKeyboard(k); + public void setKeyboard(Keyboard newKeyboard) { + final Keyboard oldKeyboard = getKeyboard(); + if (oldKeyboard instanceof LatinKeyboard) { + // Reset old keyboard state before switching to new keyboard. + ((LatinKeyboard)oldKeyboard).keyReleased(); + } + super.setKeyboard(newKeyboard); // One-seventh of the keyboard width seems like a reasonable threshold - mJumpThresholdSquare = k.getMinWidth() / 7; + mJumpThresholdSquare = newKeyboard.getMinWidth() / 7; mJumpThresholdSquare *= mJumpThresholdSquare; // Assuming there are 4 rows, this is the coordinate of the last row - mLastRowY = (k.getHeight() * 3) / 4; - setKeyboardLocal(k); + mLastRowY = (newKeyboard.getHeight() * 3) / 4; + setKeyboardLocal(newKeyboard); } @Override |