diff options
author | 2010-09-01 23:33:43 +0900 | |
---|---|---|
committer | 2010-09-02 11:47:33 +0900 | |
commit | dd8dd9fc1b10d0457a0b4b74c1c1899ff5350601 (patch) | |
tree | 3f01ccab5c9f50bd82788122b6af52ea972af552 /java/src | |
parent | 681b102a492b7d5301c1ca87985b4c391eb5eb14 (diff) | |
download | latinime-dd8dd9fc1b10d0457a0b4b74c1c1899ff5350601.tar.gz latinime-dd8dd9fc1b10d0457a0b4b74c1c1899ff5350601.tar.xz latinime-dd8dd9fc1b10d0457a0b4b74c1c1899ff5350601.zip |
Change background color for functional keys in LatinIME
Change-Id: I45f13c1fd139ce43478e5d0b2cdb62e56e9f77a8
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(); + } } /** |