summaryrefslogtreecommitdiff
path: root/java/src/com/android/inputmethod/keyboard/Key.java
diff options
context:
space:
mode:
authorSatoshi Kataoka <satok@google.com>2013-10-09 19:33:22 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-10-09 19:33:22 -0700
commitefa3ef17e9cb7cd47c2bd613e839d9f808d550b7 (patch)
tree64ddc8a7264e9c21a7747ac20676fbb9f3ef0c83 /java/src/com/android/inputmethod/keyboard/Key.java
parent2512314de199dd112a0a86b5899a67f1ed2e216a (diff)
parent26a97909f6d1cfad2cc417a2bef91d977b076158 (diff)
am 26a97909: am 3977cc97: am c7f8d54d: Merge "Prepare for changing text color for functional keys"
* commit '26a97909f6d1cfad2cc417a2bef91d977b076158': Prepare for changing text color for functional keys
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/Key.java')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Key.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 3ea68806b..f7ec9509d 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -139,6 +139,8 @@ public class Key implements Comparable<Key> {
private final OptionalAttributes mOptionalAttributes;
+ private static final int DEFAULT_TEXT_COLOR = 0xFFFFFFFF;
+
private static final class OptionalAttributes {
/** Text to output when pressed. This can be multiple characters, like ".com" */
public final String mOutputText;
@@ -602,7 +604,22 @@ public class Key implements Comparable<Key> {
}
public final int selectTextColor(final KeyDrawParams params) {
- return isShiftedLetterActivated() ? params.mTextInactivatedColor : params.mTextColor;
+ if (isShiftedLetterActivated()) {
+ return params.mTextInactivatedColor;
+ }
+ if (params.mTextColorStateList == null) {
+ return DEFAULT_TEXT_COLOR;
+ }
+ final int[] state;
+ // TODO: Hack!!!!!!!! Consider having a new attribute for the functional text labels.
+ // Currently, we distinguish "input key" from "functional key" by checking the
+ // length of the label( > 1) and "functional" attributes (= true).
+ if (mLabel != null && mLabel.length() > 1) {
+ state = getCurrentDrawableState();
+ } else {
+ state = KEY_STATE_NORMAL;
+ }
+ return params.mTextColorStateList.getColorForState(state, DEFAULT_TEXT_COLOR);
}
public final int selectHintTextSize(final KeyDrawParams params) {