Get rid of public reference to KeyboardIconsSet.ICON_* constants
As a consequence,
* Add Key.iconDisabledKey has been introduced and Key.getIcon honors
the enabled state of the key.
* The attribute id of disabled icon for shortcut key,
Keyboard_iconShortcutKeyDisabled, is renamed to
Keyboard_iconDisbledShortcutKey
* KeyboardIconsSet has getIconByIconId and getIconByAttrId methods
instead of getIcon.
Bug: 5778201
Change-Id: Ica93b073b9a04acd18ead7a33b60e3c6d813e7a1
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index c37c582..9892d78 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -191,8 +191,8 @@
<attr name="iconShortcutKey" format="reference" />
<attr name="iconShortcutForLabel" format="reference" />
<attr name="iconSpaceKeyForNumberLayout" format="reference" />
- <attr name="iconShortcutKeyDisabled" format="reference" />
<attr name="iconShiftKeyShifted" format="reference" />
+ <attr name="iconDisabledShortcutKey" format="reference" />
<attr name="iconPreviewTabKey" format="reference" />
</declare-styleable>
@@ -245,23 +245,29 @@
</attr>
<!-- The icon to display on the key instead of the label. -->
<attr name="keyIcon" format="enum">
- <!-- This should be aligned with KeyboardIcons.ICON_* -->
+ <!-- This should be aligned with the KeyboardIcons.ICONS_TO_ATTRS_MAP -->
<enum name="iconShiftKey" value="1" />
<enum name="iconDeleteKey" value="2" />
+ <!-- This is also represented as "@icon/3" in keyboard layout XML. -->
<enum name="iconSettingsKey" value="3" />
<enum name="iconSpaceKey" value="4" />
<enum name="iconReturnKey" value="5" />
<enum name="iconSearchKey" value="6" />
+ <!-- This is also represented as "@icon/7" in keyboard layout XML. -->
<enum name="iconTabKey" value="7" />
<enum name="iconShortcutKey" value="8" />
<enum name="iconShortcutForLabel" value="9" />
- <enum name="iconShortcutKeyDisabled" value="10" />
- <enum name="iconSpaceKeyForNumberLayout" value="11" />
- <enum name="iconShiftKeyShifted" value="12" />
+ <enum name="iconSpaceKeyForNumberLayout" value="10" />
+ <enum name="iconShiftKeyShifted" value="11" />
+ </attr>
+ <!-- The icon for disabled key -->
+ <attr name="keyIconDisabled" format="enum">
+ <!-- This should be aligned with the KeyboardIcons.ICONS_TO_ATTRS_MAP -->
+ <enum name="iconDisabledShortcutKey" value="12" />
</attr>
<!-- The icon to show in the popup preview. -->
<attr name="keyIconPreview" format="enum">
- <!-- This should be aligned with KeyboardIcons.ICON_PREVIEW_* -->
+ <!-- This should be aligned with the KeyboardIcons.ICONS_TO_ATTRS_MAP -->
<enum name="iconPreviewTabKey" value="13" />
</attr>
<!-- The key style to specify a set of key attributes defined by <key_style/> -->
diff --git a/java/res/values/keyboard-icons-black.xml b/java/res/values/keyboard-icons-black.xml
index 1caa16a..1c5a5f7 100644
--- a/java/res/values/keyboard-icons-black.xml
+++ b/java/res/values/keyboard-icons-black.xml
@@ -30,9 +30,9 @@
<item name="iconTabKey">@drawable/sym_bkeyboard_tab</item>
<item name="iconShortcutKey">@drawable/sym_bkeyboard_mic</item>
<item name="iconShortcutForLabel">@drawable/sym_bkeyboard_label_mic</item>
- <item name="iconShortcutKeyDisabled">@drawable/sym_bkeyboard_voice_off</item>
<item name="iconSpaceKeyForNumberLayout">@drawable/sym_bkeyboard_space</item>
<item name="iconShiftKeyShifted">@drawable/sym_bkeyboard_shift_locked</item>
+ <item name="iconDisabledShortcutKey">@drawable/sym_bkeyboard_voice_off</item>
<item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item>
</style>
</resources>
diff --git a/java/res/values/keyboard-icons-ics.xml b/java/res/values/keyboard-icons-ics.xml
index 0d4a3c7..f68be5f 100644
--- a/java/res/values/keyboard-icons-ics.xml
+++ b/java/res/values/keyboard-icons-ics.xml
@@ -29,9 +29,9 @@
<item name="iconTabKey">@drawable/sym_keyboard_tab_holo</item>
<item name="iconShortcutKey">@drawable/sym_keyboard_voice_holo</item>
<item name="iconShortcutForLabel">@drawable/sym_keyboard_label_mic_holo</item>
- <item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_holo</item>
<item name="iconSpaceKeyForNumberLayout">@drawable/sym_keyboard_space_holo</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_locked_holo</item>
+ <item name="iconDisabledShortcutKey">@drawable/sym_keyboard_voice_off_holo</item>
<item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item>
</style>
</resources>
diff --git a/java/res/values/keyboard-icons-white.xml b/java/res/values/keyboard-icons-white.xml
index a3bb268..35197a1 100644
--- a/java/res/values/keyboard-icons-white.xml
+++ b/java/res/values/keyboard-icons-white.xml
@@ -26,10 +26,10 @@
<item name="iconTabKey">@drawable/sym_keyboard_tab</item>
<item name="iconShortcutKey">@drawable/sym_keyboard_mic</item>
<item name="iconShortcutForLabel">@drawable/sym_keyboard_label_mic</item>
- <!-- TODO: Needs non-holo disabled shortcut icon drawable -->
- <item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_holo</item>
<item name="iconSpaceKeyForNumberLayout">@drawable/sym_keyboard_space</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_locked</item>
+ <!-- TODO: Needs non-holo disabled shortcut icon drawable -->
+ <item name="iconDisabledShortcutKey">@drawable/sym_keyboard_voice_off_holo</item>
<item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item>
</style>
</resources>
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index d4460c9..c4e39e3 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -307,7 +307,7 @@
<item name="spacebarTextRatio">@fraction/spacebar_text_ratio</item>
<item name="spacebarTextColor">#FFC0C0C0</item>
<item name="spacebarTextShadowColor">#80000000</item>
- </style>
+ </style>
<style
name="MiniKeyboard.IceCreamSandwich"
parent="Keyboard.IceCreamSandwich"
diff --git a/java/res/xml-sw600dp/kbd_key_styles.xml b/java/res/xml-sw600dp/kbd_key_styles.xml
index 2756010..1dd0307 100644
--- a/java/res/xml-sw600dp/kbd_key_styles.xml
+++ b/java/res/xml-sw600dp/kbd_key_styles.xml
@@ -76,6 +76,7 @@
latin:styleName="shortcutKeyStyle"
latin:code="@integer/key_shortcut"
latin:keyIcon="iconShortcutKey"
+ latin:keyIconDisabled="iconDisabledShortcutKey"
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
latin:altCode="@integer/key_dummy"
latin:parentStyle="f2PopupStyle" />
diff --git a/java/res/xml-sw768dp/kbd_key_styles.xml b/java/res/xml-sw768dp/kbd_key_styles.xml
index 83de4dd..7292fe1 100644
--- a/java/res/xml-sw768dp/kbd_key_styles.xml
+++ b/java/res/xml-sw768dp/kbd_key_styles.xml
@@ -58,6 +58,7 @@
latin:styleName="shortcutKeyStyle"
latin:code="@integer/key_shortcut"
latin:keyIcon="iconShortcutKey"
+ latin:keyIconDisabled="iconDisabledShortcutKey"
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
latin:altCode="@integer/key_dummy"
latin:backgroundType="functional" />
diff --git a/java/res/xml/kbd_key_styles.xml b/java/res/xml/kbd_key_styles.xml
index 6fdb3f5..7869d21 100644
--- a/java/res/xml/kbd_key_styles.xml
+++ b/java/res/xml/kbd_key_styles.xml
@@ -162,6 +162,7 @@
latin:styleName="shortcutKeyStyle"
latin:code="@integer/key_shortcut"
latin:keyIcon="iconShortcutKey"
+ latin:keyIconDisabled="iconDisabledShortcutKey"
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
latin:altCode="@integer/key_space"
latin:parentStyle="f1PopupStyle" />