aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2010-09-09 14:43:17 +0900
committerTadashi G. Takaoka <takaoka@google.com>2010-09-09 20:43:13 +0900
commitefc4a437942f0bccd8815059c5f9d823023cfac1 (patch)
treef74e94efbdd11ff92ef871758fbe8fb4834ba516 /java/src/com/android/inputmethod/latin/LatinIME.java
parent681b676b0aecb30e644f25550018ce2b6cea3e15 (diff)
downloadlatinime-efc4a437942f0bccd8815059c5f9d823023cfac1.tar.gz
latinime-efc4a437942f0bccd8815059c5f9d823023cfac1.tar.xz
latinime-efc4a437942f0bccd8815059c5f9d823023cfac1.zip
Symbol key acts as modifier key
On a device that has distinct multi-touch panel, pressing '123?' key will change keyboard layout to symbol mode. While pressing '123?' key, you can press other symbol key to input. Then releasing '123?' key will change keyboard layout back to alphabet mode. Bug: 2973383 Change-Id: I3b069fb19141820def8060db4766a08c7c0a6ff0
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java33
1 files changed, 21 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index ddfcaa9e3..f85206eff 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -229,8 +229,9 @@ public class LatinIME extends InputMethodService
private int mDeleteCount;
private long mLastKeyTime;
- // Shift modifier key state
+ // Modifier keys state
private ModifierKeyState mShiftKeyState = new ModifierKeyState();
+ private ModifierKeyState mSymbolKeyState = new ModifierKeyState();
private Tutorial mTutorial;
@@ -1133,6 +1134,7 @@ public class LatinIME extends InputMethodService
mDeleteCount = 0;
}
mLastKeyTime = when;
+ final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch();
switch (primaryCode) {
case Keyboard.KEYCODE_DELETE:
handleBackspace();
@@ -1141,9 +1143,14 @@ public class LatinIME extends InputMethodService
break;
case Keyboard.KEYCODE_SHIFT:
// Shift key is handled in onPress() when device has distinct multi-touch panel.
- if (!mKeyboardSwitcher.hasDistinctMultitouch())
+ if (!distinctMultiTouch)
handleShift();
break;
+ case Keyboard.KEYCODE_MODE_CHANGE:
+ // Symbol key is handled in onPress() when device has distinct multi-touch panel.
+ if (!distinctMultiTouch)
+ changeKeyboardMode();
+ break;
case Keyboard.KEYCODE_CANCEL:
if (!isShowingOptionDialog()) {
handleClose();
@@ -1161,10 +1168,6 @@ public class LatinIME extends InputMethodService
case LatinKeyboardView.KEYCODE_PREV_LANGUAGE:
toggleLanguage(false, false);
break;
- case Keyboard.KEYCODE_MODE_CHANGE:
- // TODO: Mode change (symbol key) should be handled in onPress().
- changeKeyboardMode();
- break;
case LatinKeyboardView.KEYCODE_VOICE:
if (VOICE_INSTALLED) {
startListening(false /* was a button press, was not a swipe */);
@@ -2210,13 +2213,16 @@ public class LatinIME extends InputMethodService
public void onPress(int primaryCode) {
vibrate();
playKeyClick(primaryCode);
- if (mKeyboardSwitcher.hasDistinctMultitouch() && primaryCode == Keyboard.KEYCODE_SHIFT) {
+ final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch();
+ if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_SHIFT) {
mShiftKeyState.onPress();
handleShift();
- } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE) {
- // TODO: We should handle KEYCODE_MODE_CHANGE (symbol) here as well.
+ } else if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_MODE_CHANGE) {
+ mSymbolKeyState.onPress();
+ changeKeyboardMode();
} else {
mShiftKeyState.onOtherKeyPressed();
+ mSymbolKeyState.onOtherKeyPressed();
}
}
@@ -2224,12 +2230,15 @@ public class LatinIME extends InputMethodService
// Reset any drag flags in the keyboard
((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).keyReleased();
//vibrate();
- if (mKeyboardSwitcher.hasDistinctMultitouch() && primaryCode == Keyboard.KEYCODE_SHIFT) {
+ final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch();
+ if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_SHIFT) {
if (mShiftKeyState.isMomentary())
resetShift();
mShiftKeyState.onRelease();
- } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE) {
- // TODO: We should handle KEYCODE_MODE_CHANGE (symbol) here as well.
+ } else if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_MODE_CHANGE) {
+ if (mSymbolKeyState.isMomentary())
+ changeKeyboardMode();
+ mSymbolKeyState.onRelease();
}
}