diff options
| author | Satoshi Kataoka <satok@google.com> | 2013-10-02 17:00:23 +0900 |
|---|---|---|
| committer | Satoshi Kataoka <satok@google.com> | 2013-10-03 15:54:46 +0900 |
| commit | 194e004e81f74c4124184ad8597d68e3837ea560 (patch) | |
| tree | fdb49cf0a73fab2357a13197b60b646540cc7b10 /java/src/com/android/inputmethod/keyboard/Key.java | |
| parent | c5182c9a4ae66e75df8c959bf625d08ef99f81d2 (diff) | |
Prepare for changing text color for functional keys
Bug: 10786040
Change-Id: I0de7d4923ea13b44adcf1f4ea456796cd02ef27b
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/Key.java')
| -rw-r--r-- | java/src/com/android/inputmethod/keyboard/Key.java | 19 |
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) { |
