aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorsatok <satok@google.com>2010-09-01 20:02:15 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-01 20:02:15 -0700
commit308acfa714a3a0aae073871e76e753b5a98096d1 (patch)
treef07e674dfdcce6ca0a81818e284aa047207c0dc8 /java/src
parentd8417f1cfe0c5eaf7746ecd4f8e140c15624fedd (diff)
parentac4f8e4629b0206b41c1c38271d62af88e4df21b (diff)
downloadlatinime-308acfa714a3a0aae073871e76e753b5a98096d1.tar.gz
latinime-308acfa714a3a0aae073871e76e753b5a98096d1.tar.xz
latinime-308acfa714a3a0aae073871e76e753b5a98096d1.zip
am ac4f8e46: Merge "Change background color for functional keys in LatinIME" into gingerbread
Merge commit 'ac4f8e4629b0206b41c1c38271d62af88e4df21b' into gingerbread-plus-aosp * commit 'ac4f8e4629b0206b41c1c38271d62af88e4df21b': Change background color for functional keys in LatinIME
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboard.java37
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();
+ }
}
/**