summaryrefslogtreecommitdiff
path: root/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-12-08 21:03:25 +0900
committerTadashi G. Takaoka <takaoka@google.com>2011-12-09 13:26:11 +0900
commit96c56cb577ff6b76e2c182f45402842e828c3644 (patch)
treef891b4445913b8dfd9a86fab7d149d1f898641e1 /java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
parentd52e76053031f282279112fbc6136bb9ccd643a6 (diff)
Remove direct calls of setKeyboardXXX from KeyboardSwitcher
These calls, setAlphabetKeyboard, setSymbolsKeyboard, and setSymbolsShiftedKeyboard have to be call backed from KeyboardState. Bug: 5708602 Change-Id: Ibbe1a21bd10bf942e17886869c0ab0fa1735b87e
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java37
1 files changed, 6 insertions, 31 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 734189689..6686de047 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -163,7 +163,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
mKeyboardView.setKeyboard(keyboard);
mCurrentInputView.setKeyboardGeometry(keyboard.mTopPadding);
mCurrentId = keyboard.mId;
- mState.onSetKeyboard(isAlphabetMode());
updateShiftLockState(keyboard);
mKeyboardView.setKeyPreviewPopupEnabled(
Settings.Values.isKeyPreviewPopupEnabled(mPrefs, mResources),
@@ -361,15 +360,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
if (DEBUG_STATE) {
Log.d(TAG, "toggleShift: " + mState);
}
- if (isAlphabetMode()) {
- setShifted(mState.isShiftedOrShiftLocked() ? UNSHIFT : MANUAL_SHIFT);
- } else {
- if (isSymbolShifted()) {
- setSymbolsKeyboard();
- } else {
- setSymbolsShiftedKeyboard();
- }
- }
+ mState.onToggleShift(isAlphabetMode(), isSymbolShifted());
}
/**
@@ -379,31 +370,17 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
if (DEBUG_STATE) {
Log.d(TAG, "toggleCapsLock: " + mState);
}
- if (isAlphabetMode()) {
- if (mState.isShiftLocked()) {
- setShiftLocked(false);
- // TODO: Remove this.
- // Shift key is long pressed while caps lock state, we will toggle back to normal
- // state. And mark as if shift key is released.
- mState.onReleaseCapsLock();
- } else {
- setShiftLocked(true);
- }
- }
+ mState.onToggleCapsLock(isAlphabetMode());
}
/**
- * Toggle keyboard mode triggered by user touch event.
+ * Toggle between alphabet and symbols modes triggered by user touch event.
*/
- public void toggleKeyboardMode() {
+ public void toggleAlphabetAndSymbols() {
if (DEBUG_STATE) {
- Log.d(TAG, "toggleKeyboardMode: " + mState);
- }
- if (isAlphabetMode()) {
- setSymbolsKeyboard();
- } else {
- setAlphabetKeyboard();
+ Log.d(TAG, "toggleAlphabetAndSymbols: " + mState);
}
+ mState.onToggleAlphabetAndSymbols(isAlphabetMode());
}
/**
@@ -463,7 +440,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
// Implements {@link KeyboardState.SwitchActions}.
@Override
public void setSymbolsKeyboard() {
- mState.onSaveShiftLockState();
setKeyboard(getKeyboard(mSymbolsKeyboardId));
}
@@ -471,7 +447,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
@Override
public void setAlphabetKeyboard() {
setKeyboard(getKeyboard(mMainKeyboardId));
- mState.onRestoreShiftLockState();
}
// TODO: Remove this method