From c88026e1dfa9dce6d2aee9b9964342a22644dcd1 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 13 Jan 2012 20:15:14 +0900 Subject: [PATCH] Update shift state when alphabet keyboard has been set Bug: 5857492 Change-Id: I5ef78af21a76e8cf645e223d1ffa6212690bb1eb --- .../com/android/inputmethod/keyboard/KeyboardSwitcher.java | 6 ++++++ .../inputmethod/keyboard/internal/KeyboardState.java | 6 ++++++ .../inputmethod/keyboard/internal/KeyboardStateTests.java | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index 2add2921b..54d842f09 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -324,6 +324,12 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions, setKeyboard(mKeyboardSet.getSymbolsShiftedKeyboard()); } + // Implements {@link KeyboardState.SwitchActions}. + @Override + public void requestUpdatingShiftState() { + mState.onUpdateShiftState(mInputMethodService.getCurrentAutoCapsState()); + } + public boolean isInMomentarySwitchState() { return mState.isInMomentarySwitchState(); } diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java index f54bdbb05..42f069c83 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java @@ -53,6 +53,11 @@ public class KeyboardState { public void setSymbolsKeyboard(); public void setSymbolsShiftedKeyboard(); + + /** + * Request to call back {@link KeyboardState#onUpdateShiftState(boolean)}. + */ + public void requestUpdatingShiftState(); } private KeyboardShiftState mKeyboardShiftState = new KeyboardShiftState(); @@ -212,6 +217,7 @@ public class KeyboardState { mSwitchState = SWITCH_STATE_ALPHA; setShiftLocked(mPrevMainKeyboardWasShiftLocked); mPrevMainKeyboardWasShiftLocked = false; + mSwitchActions.requestUpdatingShiftState(); } private void setSymbolsKeyboard() { diff --git a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTests.java b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTests.java index 9dc1fac3e..006a57266 100644 --- a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTests.java +++ b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTests.java @@ -71,6 +71,11 @@ public class KeyboardStateTests extends AndroidTestCase { mLayout = SYMBOLS_SHIFTED; } + @Override + public void requestUpdatingShiftState() { + mState.onUpdateShiftState(mAutoCaps); + } + public void toggleCapsLock() { mState.onToggleCapsLock(); } @@ -111,7 +116,6 @@ public class KeyboardStateTests extends AndroidTestCase { public void onCancelInput(boolean isSinglePointer) { mState.onCancelInput(isSinglePointer); } - } private MockKeyboardSwitcher mSwitcher;