diff options
author | 2012-01-27 18:10:19 +0900 | |
---|---|---|
committer | 2012-01-27 18:11:43 +0900 | |
commit | 425e1996b837422480d5599e6ed832dd310cad30 (patch) | |
tree | 40050d5850d61b3664a5fff3d8cc20e5a3827997 /java/src | |
parent | c882d619bfe6eace7330c2097008500e81d39512 (diff) | |
download | latinime-425e1996b837422480d5599e6ed832dd310cad30.tar.gz latinime-425e1996b837422480d5599e6ed832dd310cad30.tar.xz latinime-425e1996b837422480d5599e6ed832dd310cad30.zip |
Add inactivatedLabel and inactivatedUppercaseLetter flags for Key.keyLabelFlags
Change-Id: I6c7dc79cbad360602b278283f4c3a24c54040622
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/Key.java | 10 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyboardView.java | 14 |
2 files changed, 21 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 9c495fd5f..bb90653c1 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -72,6 +72,8 @@ public class Key { private static final int LABEL_FLAGS_WITH_ICON_RIGHT = 0x2000; private static final int LABEL_FLAGS_AUTO_X_SCALE = 0x4000; private static final int LABEL_FLAGS_PRESERVE_CASE = 0x8000; + private static final int LABEL_FLAGS_INACTIVATED_LABEL = 0x10000; + private static final int LABEL_FLAGS_INACTIVATED_UPPERCASE_LETTER = 0x20000; /** Icon to display instead of a label. Icon takes precedence over a label */ private final int mIconAttrId; @@ -509,6 +511,14 @@ public class Key { return (mLabelFlags & LABEL_FLAGS_AUTO_X_SCALE) != 0; } + public boolean isInactivatedLabel() { + return (mLabelFlags & LABEL_FLAGS_INACTIVATED_LABEL) != 0; + } + + public boolean isInactivatedUppercaseLetter() { + return (mLabelFlags & LABEL_FLAGS_INACTIVATED_UPPERCASE_LETTER) != 0; + } + // TODO: Get rid of this method. public Drawable getIcon(KeyboardIconsSet iconSet) { return mEnabled ? mIcon : iconSet.getIconByAttrId(mDisabledIconAttrId); diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 6f4ef2580..d977327a8 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -571,8 +571,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { Math.min(1.0f, (keyWidth * MAX_LABEL_RATIO) / getLabelWidth(label, paint))); } + // TODO: Remove this first if-clause. if (key.hasUppercaseLetter() && mKeyboard.isManualTemporaryUpperCase()) { paint.setColor(params.mKeyTextInactivatedColor); + } else if (key.isInactivatedLabel()) { + paint.setColor(params.mKeyTextInactivatedColor); } else { paint.setColor(params.mKeyTextColor); } @@ -618,9 +621,14 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { hintSize = params.mKeyHintLabelSize; paint.setTypeface(Typeface.DEFAULT); } else if (key.hasUppercaseLetter()) { - hintColor = mKeyboard.isManualTemporaryUpperCase() - ? params.mKeyUppercaseLetterActivatedColor - : params.mKeyUppercaseLetterInactivatedColor; + // TODO: Remove this first if-clause. + if (mKeyboard.isManualTemporaryUpperCase()) { + hintColor = params.mKeyUppercaseLetterActivatedColor; + } else if (!key.isInactivatedUppercaseLetter()) { + hintColor = params.mKeyUppercaseLetterActivatedColor; + } else { + hintColor = params.mKeyUppercaseLetterInactivatedColor; + } hintSize = params.mKeyUppercaseLetterSize; } else { // key.hasHintLetter() hintColor = params.mKeyHintLetterColor; |