Merge "Use slightly dimmed text color for functional keys"

main
Tadashi G. Takaoka 2014-05-15 07:09:52 +00:00 committed by Android (Google) Code Review
commit 591ec83e40
12 changed files with 23 additions and 5 deletions

View File

@ -311,6 +311,9 @@
<flag name="shiftedLetterActivated" value="0x20000" />
<!-- If true, use EditorInfo.actionLabel for the key label. -->
<flag name="fromCustomActionLabel" value="0x40000" />
<!-- If true, use functionalTextColor instead of ketTextColor to drawing the label on
the key -->
<flag name="followFunctionalTextColor" value="0x80000" />
<!-- If true, disable keyHintLabel. -->
<flag name="disableKeyHintLabel" value="0x40000000" />
<!-- If true, disable additionalMoreKeys. -->
@ -367,6 +370,8 @@
<attr name="keyTextShadowColor" format="color" />
<!-- Color to use for the label in a key when in inactivated state. -->
<attr name="keyTextInactivatedColor" format="color" />
<!-- Color to use for the label in a key that has followFunctionalTextColor keyLabelFlags. -->
<attr name="functionalTextColor" format="color" />
<!-- Key hint letter (= one character hint label) color -->
<attr name="keyHintLetterColor" format="color" />
<!-- Key hint label color -->

View File

@ -53,6 +53,7 @@
<item name="keyTypeface">bold</item>
<item name="keyTextColor">@color/key_text_color_holo</item>
<item name="keyTextInactivatedColor">@color/key_text_inactivated_color_holo</item>
<item name="functionalTextColor">@color/key_text_color_holo</item>
<item name="keyHintLetterColor">@color/key_hint_letter_color_holo</item>
<item name="keyHintLabelColor">@color/key_hint_label_color_holo</item>
<item name="keyShiftedLetterHintInactivatedColor">@color/key_shifted_letter_hint_inactivated_color_holo</item>

View File

@ -53,6 +53,7 @@
<item name="keyTypeface">bold</item>
<item name="keyTextColor">@color/key_text_color_holo</item>
<item name="keyTextInactivatedColor">@color/key_text_inactivated_color_holo</item>
<item name="functionalTextColor">@color/key_text_color_holo</item>
<item name="keyHintLetterColor">@color/key_hint_letter_color_holo</item>
<item name="keyHintLabelColor">@color/key_hint_label_color_holo</item>
<item name="keyShiftedLetterHintInactivatedColor">@color/key_shifted_letter_hint_inactivated_color_holo</item>

View File

@ -53,6 +53,7 @@
<item name="keyTypeface">bold</item>
<item name="keyTextColor">@color/key_text_color_holo</item>
<item name="keyTextInactivatedColor">@color/key_text_inactive_color_lxx</item>
<item name="functionalTextColor">@color/key_hint_letter_color_lxx</item>
<item name="keyHintLetterColor">@color/key_hint_letter_color_lxx</item>
<item name="keyHintLabelColor">@color/key_text_inactive_color_lxx</item>
<item name="keyShiftedLetterHintInactivatedColor">@color/key_text_inactive_color_lxx</item>

View File

@ -140,7 +140,7 @@
</switch>
<key-style
latin:styleName="baseForLayoutSwitchKeyStyle"
latin:keyLabelFlags="preserveCase"
latin:keyLabelFlags="preserveCase|followFunctionalTextColor"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="functional" />
<key-style

View File

@ -100,7 +100,7 @@
<key-style
latin:styleName="defaultEnterKeyStyle"
latin:keySpec="!icon/enter_key|!code/key_enter"
latin:keyLabelFlags="preserveCase|autoXScale|followKeyLabelRatio"
latin:keyLabelFlags="preserveCase|autoXScale|followKeyLabelRatio|followFunctionalTextColor"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="functional"
latin:parentStyle="navigateMoreKeysStyle" />

View File

@ -128,7 +128,7 @@
latin:keyIconPreview="!icon/tab_key_preview" />
<key-style
latin:styleName="baseForLayoutSwitchKeyStyle"
latin:keyLabelFlags="preserveCase"
latin:keyLabelFlags="preserveCase|followFunctionalTextColor"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="functional" />
<key-style

View File

@ -255,7 +255,7 @@
<!-- Enter key style -->
<key-style
latin:styleName="defaultEnterKeyStyle"
latin:keyLabelFlags="preserveCase|autoXScale|followKeyLabelRatio"
latin:keyLabelFlags="preserveCase|autoXScale|followKeyLabelRatio|followFunctionalTextColor"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="functional"
latin:parentStyle="navigateMoreKeysStyle" />

View File

@ -30,7 +30,7 @@
latin:parentStyle="numKeyBaseStyle" />
<key-style
latin:styleName="numModeKeyStyle"
latin:keyLabelFlags="fontNormal|followKeyLetterRatio"
latin:keyLabelFlags="fontNormal|followKeyLetterRatio|followFunctionalTextColor"
latin:parentStyle="numKeyBaseStyle" />
<key-style
latin:styleName="numFunctionalKeyStyle"

View File

@ -86,6 +86,7 @@ public class Key implements Comparable<Key> {
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<Key> {
}
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;
}

View File

@ -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(

View File

@ -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(