From 37ec0fe9840aeb3fdf4a5749945045f7a76fd16b Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 15 May 2014 15:39:01 +0900 Subject: [PATCH] Use slightly dimmed text color for functional keys This CL introduces two new key attributes to achieve this. - KeyboardView.functionalTextColor - followFunctionalTextColor flag for Key.keyLabelFlags Bug: 14419121 Change-Id: I45ca433dcc9cc8c6cf891e21d5316ee4048b0cad --- java/res/values/attrs.xml | 5 +++++ java/res/values/themes-ics.xml | 1 + java/res/values/themes-klp.xml | 1 + java/res/values/themes-lxx.xml | 1 + java/res/xml-sw600dp/key_styles_common.xml | 2 +- java/res/xml-sw600dp/key_styles_enter.xml | 2 +- java/res/xml/key_styles_common.xml | 2 +- java/res/xml/key_styles_enter.xml | 2 +- java/res/xml/key_styles_number.xml | 2 +- java/src/com/android/inputmethod/keyboard/Key.java | 4 ++++ .../android/inputmethod/keyboard/internal/KeyDrawParams.java | 3 +++ .../inputmethod/keyboard/internal/KeyVisualAttributes.java | 3 +++ 12 files changed, 23 insertions(+), 5 deletions(-) diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 79cc139a2..701d19572 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -311,6 +311,9 @@ + + @@ -367,6 +370,8 @@ + + diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml index 560cfc505..79f90365b 100644 --- a/java/res/values/themes-ics.xml +++ b/java/res/values/themes-ics.xml @@ -53,6 +53,7 @@ bold @color/key_text_color_holo @color/key_text_inactivated_color_holo + @color/key_text_color_holo @color/key_hint_letter_color_holo @color/key_hint_label_color_holo @color/key_shifted_letter_hint_inactivated_color_holo diff --git a/java/res/values/themes-klp.xml b/java/res/values/themes-klp.xml index 453e5cbce..dfeca1c27 100644 --- a/java/res/values/themes-klp.xml +++ b/java/res/values/themes-klp.xml @@ -53,6 +53,7 @@ bold @color/key_text_color_holo @color/key_text_inactivated_color_holo + @color/key_text_color_holo @color/key_hint_letter_color_holo @color/key_hint_label_color_holo @color/key_shifted_letter_hint_inactivated_color_holo diff --git a/java/res/values/themes-lxx.xml b/java/res/values/themes-lxx.xml index 4f3ee80c9..899d26a7e 100644 --- a/java/res/values/themes-lxx.xml +++ b/java/res/values/themes-lxx.xml @@ -53,6 +53,7 @@ bold @color/key_text_color_holo @color/key_text_inactive_color_lxx + @color/key_hint_letter_color_lxx @color/key_hint_letter_color_lxx @color/key_text_inactive_color_lxx @color/key_text_inactive_color_lxx diff --git a/java/res/xml-sw600dp/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml index f9b959b76..35b3576af 100644 --- a/java/res/xml-sw600dp/key_styles_common.xml +++ b/java/res/xml-sw600dp/key_styles_common.xml @@ -140,7 +140,7 @@ diff --git a/java/res/xml/key_styles_common.xml b/java/res/xml/key_styles_common.xml index 773995fa8..f8b4a2a60 100644 --- a/java/res/xml/key_styles_common.xml +++ b/java/res/xml/key_styles_common.xml @@ -128,7 +128,7 @@ latin:keyIconPreview="!icon/tab_key_preview" /> diff --git a/java/res/xml/key_styles_number.xml b/java/res/xml/key_styles_number.xml index 5c108cf58..df4448c25 100644 --- a/java/res/xml/key_styles_number.xml +++ b/java/res/xml/key_styles_number.xml @@ -30,7 +30,7 @@ latin:parentStyle="numKeyBaseStyle" /> { private static final int LABEL_FLAGS_PRESERVE_CASE = 0x10000; private static final int LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED = 0x20000; private static final int LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL = 0x40000; + private static final int LABEL_FLAGS_FOLLOW_FUNCTIONAL_TEXT_COLOR = 0x80000; private static final int LABEL_FLAGS_DISABLE_HINT_LABEL = 0x40000000; private static final int LABEL_FLAGS_DISABLE_ADDITIONAL_MORE_KEYS = 0x80000000; @@ -583,6 +584,9 @@ public class Key implements Comparable { } public final int selectTextColor(final KeyDrawParams params) { + if ((mLabelFlags & LABEL_FLAGS_FOLLOW_FUNCTIONAL_TEXT_COLOR) != 0) { + return params.mFunctionalTextColor; + } return isShiftedLetterActivated() ? params.mTextInactivatedColor : params.mTextColor; } diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java index 1716fa049..07ac06bab 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java @@ -35,6 +35,7 @@ public final class KeyDrawParams { public int mTextColor; public int mTextInactivatedColor; public int mTextShadowColor; + public int mFunctionalTextColor; public int mHintLetterColor; public int mHintLabelColor; public int mShiftedLetterHintInactivatedColor; @@ -60,6 +61,7 @@ public final class KeyDrawParams { mTextColor = copyFrom.mTextColor; mTextInactivatedColor = copyFrom.mTextInactivatedColor; mTextShadowColor = copyFrom.mTextShadowColor; + mFunctionalTextColor = copyFrom.mFunctionalTextColor; mHintLetterColor = copyFrom.mHintLetterColor; mHintLabelColor = copyFrom.mHintLabelColor; mShiftedLetterHintInactivatedColor = copyFrom.mShiftedLetterHintInactivatedColor; @@ -93,6 +95,7 @@ public final class KeyDrawParams { mTextColor = selectColor(attr.mTextColor, mTextColor); mTextInactivatedColor = selectColor(attr.mTextInactivatedColor, mTextInactivatedColor); mTextShadowColor = selectColor(attr.mTextShadowColor, mTextShadowColor); + mFunctionalTextColor = selectColor(attr.mFunctionalTextColor, mFunctionalTextColor); mHintLetterColor = selectColor(attr.mHintLetterColor, mHintLetterColor); mHintLabelColor = selectColor(attr.mHintLabelColor, mHintLabelColor); mShiftedLetterHintInactivatedColor = selectColor( diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java b/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java index df386fce4..133462ac7 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java @@ -40,6 +40,7 @@ public final class KeyVisualAttributes { public final int mTextColor; public final int mTextInactivatedColor; public final int mTextShadowColor; + public final int mFunctionalTextColor; public final int mHintLetterColor; public final int mHintLabelColor; public final int mShiftedLetterHintInactivatedColor; @@ -61,6 +62,7 @@ public final class KeyVisualAttributes { R.styleable.Keyboard_Key_keyTextColor, R.styleable.Keyboard_Key_keyTextInactivatedColor, R.styleable.Keyboard_Key_keyTextShadowColor, + R.styleable.Keyboard_Key_functionalTextColor, R.styleable.Keyboard_Key_keyHintLetterColor, R.styleable.Keyboard_Key_keyHintLabelColor, R.styleable.Keyboard_Key_keyShiftedLetterHintInactivatedColor, @@ -122,6 +124,7 @@ public final class KeyVisualAttributes { mTextInactivatedColor = keyAttr.getColor( R.styleable.Keyboard_Key_keyTextInactivatedColor, 0); mTextShadowColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyTextShadowColor, 0); + mFunctionalTextColor = keyAttr.getColor(R.styleable.Keyboard_Key_functionalTextColor, 0); mHintLetterColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyHintLetterColor, 0); mHintLabelColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyHintLabelColor, 0); mShiftedLetterHintInactivatedColor = keyAttr.getColor(