aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/KeyboardSwitcher.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/KeyboardSwitcher.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/KeyboardSwitcher.java')
-rw-r--r--java/src/com/android/inputmethod/latin/KeyboardSwitcher.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
index fdcf0ad4e..fce0e34fe 100644
--- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
@@ -75,7 +75,9 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private final LatinIME mInputMethodService;
private final LanguageSwitcher mLanguageSwitcher;
+ private ShiftKeyState mShiftState = new ShiftKeyState();
private ModifierKeyState mSymbolKeyState = new ModifierKeyState();
+
private KeyboardId mSymbolsId;
private KeyboardId mSymbolsShiftedId;
@@ -383,6 +385,30 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mInputView.setShiftLocked(shiftLocked);
}
+ public void onPressShift() {
+ mShiftState.onPress();
+ }
+
+ public void onPressShiftOnShifted() {
+ mShiftState.onPressOnShifted();
+ }
+
+ public void onReleaseShift() {
+ mShiftState.onRelease();
+ }
+
+ public boolean isShiftMomentary() {
+ return mShiftState.isMomentary();
+ }
+
+ public boolean isShiftPressingOnShifted() {
+ return mShiftState.isPressingOnShifted();
+ }
+
+ public boolean isShiftIgnoring() {
+ return mShiftState.isIgnoring();
+ }
+
public void onPressSymbol() {
mSymbolKeyState.onPress();
}
@@ -396,7 +422,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
public void onOtherKeyPressed() {
- // TODO: shift key state will be handled too.
+ mShiftState.onOtherKeyPressed();
mSymbolKeyState.onOtherKeyPressed();
}