aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2013-05-21 17:14:31 -0700
committerTadashi G. Takaoka <takaoka@google.com>2013-06-04 18:20:06 +0900
commit9552badf3c24d2098d227b0ddca0721b928a10b1 (patch)
treec828bfe0f5b8d68fbb61d699cfaf0b2c8ff8d4a2 /java/src/com/android/inputmethod/latin
parent2a9882a433e2372ac32fbc0def578d4d9a97a676 (diff)
downloadlatinime-9552badf3c24d2098d227b0ddca0721b928a10b1.tar.gz
latinime-9552badf3c24d2098d227b0ddca0721b928a10b1.tar.xz
latinime-9552badf3c24d2098d227b0ddca0721b928a10b1.zip
Add CODE_CAPSLOCK for long press shift key
This change utilizes the no panel auto more key feature to implement long press shift key for shift lock. Change-Id: I3995d25dc35aea3c67b5aa29299815462eff9cad
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r--java/src/com/android/inputmethod/latin/Constants.java28
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java15
2 files changed, 25 insertions, 18 deletions
diff --git a/java/src/com/android/inputmethod/latin/Constants.java b/java/src/com/android/inputmethod/latin/Constants.java
index 64c14d32f..bb4a42ede 100644
--- a/java/src/com/android/inputmethod/latin/Constants.java
+++ b/java/src/com/android/inputmethod/latin/Constants.java
@@ -172,22 +172,23 @@ public final class Constants {
/**
* Special keys code. Must be negative.
- * These should be aligned with KeyboardCodesSet.ID_TO_NAME[],
- * KeyboardCodesSet.DEFAULT[] and KeyboardCodesSet.RTL[]
+ * These should be aligned with {@link KeyboardCodesSet#ID_TO_NAME},
+ * {@link KeyboardCodesSet#DEFAULT}, and {@link KeyboardCodesSet#RTL}.
*/
public static final int CODE_SHIFT = -1;
- public static final int CODE_SWITCH_ALPHA_SYMBOL = -2;
- public static final int CODE_OUTPUT_TEXT = -3;
- public static final int CODE_DELETE = -4;
- public static final int CODE_SETTINGS = -5;
- public static final int CODE_SHORTCUT = -6;
- public static final int CODE_ACTION_NEXT = -7;
- public static final int CODE_ACTION_PREVIOUS = -8;
- public static final int CODE_LANGUAGE_SWITCH = -9;
- public static final int CODE_RESEARCH = -10;
- public static final int CODE_SHIFT_ENTER = -11;
+ public static final int CODE_CAPSLOCK = -2;
+ public static final int CODE_SWITCH_ALPHA_SYMBOL = -3;
+ public static final int CODE_OUTPUT_TEXT = -4;
+ public static final int CODE_DELETE = -5;
+ public static final int CODE_SETTINGS = -6;
+ public static final int CODE_SHORTCUT = -7;
+ public static final int CODE_ACTION_NEXT = -8;
+ public static final int CODE_ACTION_PREVIOUS = -9;
+ public static final int CODE_LANGUAGE_SWITCH = -10;
+ public static final int CODE_RESEARCH = -11;
+ public static final int CODE_SHIFT_ENTER = -12;
// Code value representing the code is not specified.
- public static final int CODE_UNSPECIFIED = -12;
+ public static final int CODE_UNSPECIFIED = -13;
public static boolean isLetterCode(final int code) {
return code >= CODE_SPACE;
@@ -196,6 +197,7 @@ public final class Constants {
public static String printableCode(final int code) {
switch (code) {
case CODE_SHIFT: return "shift";
+ case CODE_CAPSLOCK: return "capslock";
case CODE_SWITCH_ALPHA_SYMBOL: return "symbol";
case CODE_OUTPUT_TEXT: return "text";
case CODE_DELETE: return "delete";
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 70f8d0de8..6ac54748c 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1420,8 +1420,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
LatinImeLogger.logOnDelete(x, y);
break;
case Constants.CODE_SHIFT:
- // Note: calling back to the keyboard on Shift key is handled in onPressKey()
- // and onReleaseKey().
+ // Note: Calling back to the keyboard on Shift key is handled in
+ // {@link #onPressKey(int,boolean)} and {@link #onReleaseKey(int,boolean)}.
final Keyboard currentKeyboard = switcher.getKeyboard();
if (null != currentKeyboard && currentKeyboard.mId.isAlphabetKeyboard()) {
// TODO: Instead of checking for alphabetic keyboard here, separate keycodes for
@@ -1429,9 +1429,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
handleRecapitalize();
}
break;
+ case Constants.CODE_CAPSLOCK:
+ // Note: Changing keyboard to shift lock state is handled in
+ // {@link KeyboardSwitcher#onCodeInput(int)}.
+ break;
case Constants.CODE_SWITCH_ALPHA_SYMBOL:
- // Note: calling back to the keyboard on symbol key is handled in onPressKey()
- // and onReleaseKey().
+ // Note: Calling back to the keyboard on symbol key is handled in
+ // {@link #onPressKey(int,boolean)} and {@link #onReleaseKey(int,boolean)}.
break;
case Constants.CODE_SETTINGS:
onSettingsKeyPressed();
@@ -1484,8 +1488,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
break;
}
switcher.onCodeInput(primaryCode);
- // Reset after any single keystroke, except shift and symbol-shift
+ // Reset after any single keystroke, except shift, capslock, and symbol-shift
if (!didAutoCorrect && primaryCode != Constants.CODE_SHIFT
+ && primaryCode != Constants.CODE_CAPSLOCK
&& primaryCode != Constants.CODE_SWITCH_ALPHA_SYMBOL)
mLastComposedWord.deactivate();
if (Constants.CODE_DELETE != primaryCode) {