diff options
author | 2010-09-01 19:52:46 -0700 | |
---|---|---|
committer | 2010-09-01 19:52:46 -0700 | |
commit | ac4f8e4629b0206b41c1c38271d62af88e4df21b (patch) | |
tree | f07e674dfdcce6ca0a81818e284aa047207c0dc8 /java/src | |
parent | f7d71c338f2585810ca2da95e7aee5c166b06ac2 (diff) | |
parent | dd8dd9fc1b10d0457a0b4b74c1c1899ff5350601 (diff) | |
download | latinime-ac4f8e4629b0206b41c1c38271d62af88e4df21b.tar.gz latinime-ac4f8e4629b0206b41c1c38271d62af88e4df21b.tar.xz latinime-ac4f8e4629b0206b41c1c38271d62af88e4df21b.zip |
Merge "Change background color for functional keys in LatinIME" into gingerbread
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinKeyboard.java | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 15e22f318..33519e4be 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -628,9 +628,20 @@ public class LatinKeyboard extends Keyboard { } class LatinKey extends Keyboard.Key { - + + // functional normal state (with properties) + private final int[] KEY_STATE_FUNCTIONAL_NORMAL = { + android.R.attr.state_single + }; + + // functional pressed state (with properties) + private final int[] KEY_STATE_FUNCTIONAL_PRESSED = { + android.R.attr.state_single, + android.R.attr.state_pressed + }; + private boolean mShiftLockEnabled; - + public LatinKey(Resources res, Keyboard.Row parent, int x, int y, XmlResourceParser parser) { super(res, parent, x, y, parser); @@ -639,11 +650,17 @@ public class LatinKeyboard extends Keyboard { popupResId = 0; } } - - void enableShiftLock() { + + private void enableShiftLock() { mShiftLockEnabled = true; } + // sticky is used for shift key. If a key is not sticky and is modifier, + // the key will be treated as functional. + private boolean isFunctionalKey() { + return !sticky && modifier; + } + @Override public void onReleased(boolean inside) { if (!mShiftLockEnabled) { @@ -665,6 +682,18 @@ public class LatinKeyboard extends Keyboard { boolean isInsideSuper(int x, int y) { return super.isInside(x, y); } + + @Override + public int[] getCurrentDrawableState() { + if (isFunctionalKey()) { + if (pressed) { + return KEY_STATE_FUNCTIONAL_PRESSED; + } else { + return KEY_STATE_FUNCTIONAL_NORMAL; + } + } + return super.getCurrentDrawableState(); + } } /** |