diff options
author | 2010-09-01 20:06:05 -0700 | |
---|---|---|
committer | 2010-09-01 20:06:05 -0700 | |
commit | ee01bf14089dead86a6a662d82cdafebba6cdab2 (patch) | |
tree | 36071903d68ab9b1f95464b0e8bf175de8193d3b /java/src | |
parent | 896aa23f0693b284f83311809fd39ae92a13d865 (diff) | |
parent | 308acfa714a3a0aae073871e76e753b5a98096d1 (diff) | |
download | latinime-ee01bf14089dead86a6a662d82cdafebba6cdab2.tar.gz latinime-ee01bf14089dead86a6a662d82cdafebba6cdab2.tar.xz latinime-ee01bf14089dead86a6a662d82cdafebba6cdab2.zip |
am 308acfa7: am ac4f8e46: Merge "Change background color for functional keys in LatinIME" into gingerbread
Merge commit '308acfa714a3a0aae073871e76e753b5a98096d1'
* commit '308acfa714a3a0aae073871e76e753b5a98096d1':
Change background color for functional keys in LatinIME
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(); + } } /** |