aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinKeyboardView.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboardView.java15
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