aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2010-11-16 01:47:39 -0800
committerTadashi G. Takaoka <takaoka@google.com>2010-11-16 01:47:39 -0800
commit889691eca1ad991a85fb721deb37ecba6a913762 (patch)
tree04c3c38ff7b58adf6b83f4af759725d7bb80d1e6 /java/src/com/android/inputmethod/latin/LatinIME.java
parentd7641636db8fe91d9847ac79f5f431963e876ec3 (diff)
downloadlatinime-889691eca1ad991a85fb721deb37ecba6a913762.tar.gz
latinime-889691eca1ad991a85fb721deb37ecba6a913762.tar.xz
latinime-889691eca1ad991a85fb721deb37ecba6a913762.zip
Refactor shift key state into KeyboardSwitcher
Change-Id: If484d3d7e7a0794ee7fc88f0771229d6f90db466
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index a432eaa02..156d0bcca 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -235,9 +235,6 @@ public class LatinIME extends InputMethodService
private int mDeleteCount;
private long mLastKeyTime;
- // Modifier keys state
- private final ModifierKeyState mShiftKeyState = new ModifierKeyState();
-
private Tutorial mTutorial;
private AudioManager mAudioManager;
@@ -1091,8 +1088,8 @@ public class LatinIME extends InputMethodService
if (!switcher.isKeyboardAvailable())
return;
if (ic != null && attr != null && switcher.isAlphabetMode()
- && !mShiftKeyState.isIgnoring()) {
- switcher.setShifted(mShiftKeyState.isMomentary()
+ && !switcher.isShiftIgnoring()) {
+ switcher.setShifted(switcher.isShiftMomentary()
|| switcher.isShiftLocked() || getCursorCapsMode(ic, attr) != 0);
}
}
@@ -2342,16 +2339,15 @@ public class LatinIME extends InputMethodService
// In alphabet mode, we call handleShift() to go into the shifted mode in this
// method, onPress(), only when we are in the small letter mode.
if (switcher.isAlphabetMode() && switcher.isShifted()) {
- mShiftKeyState.onPressOnShifted();
+ switcher.onPressShiftOnShifted();
} else {
- mShiftKeyState.onPress();
+ switcher.onPressShift();
handleShift();
}
} else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) {
switcher.onPressSymbol();
changeKeyboardMode();
} else {
- mShiftKeyState.onOtherKeyPressed();
switcher.onOtherKeyPressed();
}
}
@@ -2364,18 +2360,18 @@ public class LatinIME extends InputMethodService
switcher.keyReleased();
final boolean distinctMultiTouch = switcher.hasDistinctMultitouch();
if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_SHIFT) {
- if (mShiftKeyState.isMomentary()) {
+ if (switcher.isShiftMomentary()) {
resetShift();
}
if (switcher.isAlphabetMode()) {
// In alphabet mode, we call handleShift() to go into the small letter mode in this
// method, onRelease(), only when we are in the shifted modes -- temporary shifted
// mode or caps lock mode.
- if (switcher.isShifted() && mShiftKeyState.isPressingOnShifted()) {
+ if (switcher.isShifted() && switcher.isShiftPressingOnShifted()) {
handleShift();
}
}
- mShiftKeyState.onRelease();
+ switcher.onReleaseShift();
} else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) {
if (switcher.isSymbolMomentary()) {
changeKeyboardMode();