Use !icon/<icon_name> notation for more keys spec
Change-Id: I616e6c1ac603d2eb7a5c99ec70d5411371d15f3emain
parent
ed3bac91f2
commit
7f0c503afc
|
@ -300,6 +300,7 @@
|
||||||
<flag name="disableAdditionalMoreKeys" value="0x80000000" />
|
<flag name="disableAdditionalMoreKeys" value="0x80000000" />
|
||||||
</attr>
|
</attr>
|
||||||
<!-- The icon to display on the key instead of the label. -->
|
<!-- The icon to display on the key instead of the label. -->
|
||||||
|
<!-- TODO: Use string format !icon/name. -->
|
||||||
<attr name="keyIcon" format="enum">
|
<attr name="keyIcon" format="enum">
|
||||||
<!-- This should be aligned with the KeyboardIconsSet.ICON_* -->
|
<!-- This should be aligned with the KeyboardIconsSet.ICON_* -->
|
||||||
<enum name="iconUndefined" value="0" />
|
<enum name="iconUndefined" value="0" />
|
||||||
|
@ -319,11 +320,13 @@
|
||||||
<enum name="iconZwjKey" value="16" />
|
<enum name="iconZwjKey" value="16" />
|
||||||
</attr>
|
</attr>
|
||||||
<!-- The icon for disabled key -->
|
<!-- The icon for disabled key -->
|
||||||
|
<!-- TODO: Use string format !icon/name. -->
|
||||||
<attr name="keyIconDisabled" format="enum">
|
<attr name="keyIconDisabled" format="enum">
|
||||||
<!-- This should be aligned with the KeyboardIconsSet.ICON_* -->
|
<!-- This should be aligned with the KeyboardIconsSet.ICON_* -->
|
||||||
<enum name="iconDisabledShortcutKey" value="12" />
|
<enum name="iconDisabledShortcutKey" value="12" />
|
||||||
</attr>
|
</attr>
|
||||||
<!-- The icon to show in the popup preview. -->
|
<!-- The icon to show in the popup preview. -->
|
||||||
|
<!-- TODO: Use string format !icon/name. -->
|
||||||
<attr name="keyIconPreview" format="enum">
|
<attr name="keyIconPreview" format="enum">
|
||||||
<!-- This should be aligned with the KeyboardIconsSet.ICON_* -->
|
<!-- This should be aligned with the KeyboardIconsSet.ICON_* -->
|
||||||
<enum name="iconPreviewTabKey" value="13" />
|
<enum name="iconPreviewTabKey" value="13" />
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
U+2205: "∅" EMPTY SET -->
|
U+2205: "∅" EMPTY SET -->
|
||||||
<string name="more_keys_for_symbols_0">ⁿ,∅</string>
|
<string name="more_keys_for_symbols_0">ⁿ,∅</string>
|
||||||
<string name="more_keys_for_am_pm">!fixedColumnOrder!2,!hasLabels!,\@string/label_time_am,\@string/label_time_pm</string>
|
<string name="more_keys_for_am_pm">!fixedColumnOrder!2,!hasLabels!,\@string/label_time_am,\@string/label_time_pm</string>
|
||||||
<string name="settings_as_more_key">\@icon/settingsKey|!code/key_settings</string>
|
<string name="settings_as_more_key">!icon/settingsKey|!code/key_settings</string>
|
||||||
<string name="keylabel_for_comma">,</string>
|
<string name="keylabel_for_comma">,</string>
|
||||||
<string name="more_keys_for_comma"></string>
|
<string name="more_keys_for_comma"></string>
|
||||||
<string name="action_next_as_more_key">!hasLabels!,\@string/label_next_key|!code/key_action_next</string>
|
<string name="action_next_as_more_key">!hasLabels!,\@string/label_next_key|!code/key_action_next</string>
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
latin:styleName="zwnjKeyStyle"
|
latin:styleName="zwnjKeyStyle"
|
||||||
latin:code="0x200C"
|
latin:code="0x200C"
|
||||||
latin:keyIcon="iconZwnjKey"
|
latin:keyIcon="iconZwnjKey"
|
||||||
latin:moreKeys="\@icon/zwjKey|‍"
|
latin:moreKeys="!icon/zwjKey|‍"
|
||||||
latin:keyLabelFlags="hasPopupHint"
|
latin:keyLabelFlags="hasPopupHint"
|
||||||
latin:keyActionFlags="noKeyPreview" />
|
latin:keyActionFlags="noKeyPreview" />
|
||||||
<key-style
|
<key-style
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
latin:styleName="zwnjKeyStyle"
|
latin:styleName="zwnjKeyStyle"
|
||||||
latin:code="0x200C"
|
latin:code="0x200C"
|
||||||
latin:keyIcon="iconZwnjKey"
|
latin:keyIcon="iconZwnjKey"
|
||||||
latin:moreKeys="\@icon/zwjKey|‍"
|
latin:moreKeys="!icon/zwjKey|‍"
|
||||||
latin:keyLabelFlags="hasPopupHint"
|
latin:keyLabelFlags="hasPopupHint"
|
||||||
latin:keyActionFlags="noKeyPreview" />
|
latin:keyActionFlags="noKeyPreview" />
|
||||||
<key-style
|
<key-style
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
latin:styleName="zwnjKeyStyle"
|
latin:styleName="zwnjKeyStyle"
|
||||||
latin:code="0x200C"
|
latin:code="0x200C"
|
||||||
latin:keyIcon="iconZwnjKey"
|
latin:keyIcon="iconZwnjKey"
|
||||||
latin:moreKeys="\@icon/zwjKey|‍"
|
latin:moreKeys="!icon/zwjKey|‍"
|
||||||
latin:keyLabelFlags="hasPopupHint"
|
latin:keyLabelFlags="hasPopupHint"
|
||||||
latin:keyActionFlags="noKeyPreview"
|
latin:keyActionFlags="noKeyPreview"
|
||||||
latin:backgroundType="functional" />
|
latin:backgroundType="functional" />
|
||||||
|
|
|
@ -32,10 +32,11 @@ import java.util.Arrays;
|
||||||
* - String resource can be embedded into specification @string/name. This is done before parsing
|
* - String resource can be embedded into specification @string/name. This is done before parsing
|
||||||
* comma.
|
* comma.
|
||||||
* Each "more key" specification is one of the following:
|
* Each "more key" specification is one of the following:
|
||||||
* - A single letter (Letter)
|
|
||||||
* - Label optionally followed by keyOutputText or code (keyLabel|keyOutputText).
|
* - Label optionally followed by keyOutputText or code (keyLabel|keyOutputText).
|
||||||
* - Icon followed by keyOutputText or a string representation of codes
|
* - Icon followed by keyOutputText or code (!icon/icon_name|!code/code_name)
|
||||||
* (@icon/icon_name|!code/key_code)
|
* - Icon should be a string representation of icon (!icon/icon_name).
|
||||||
|
* - Code should be a code point presented by hexadecimal string prefixed with "0x".
|
||||||
|
* Or a string representation of code (!code/code_name).
|
||||||
* Special character, comma ',' backslash '\', and bar '|' can be escaped by '\' character.
|
* Special character, comma ',' backslash '\', and bar '|' can be escaped by '\' character.
|
||||||
* Note that the character '@' and '\' are also parsed by XML parser and CSV parser as well.
|
* Note that the character '@' and '\' are also parsed by XML parser and CSV parser as well.
|
||||||
* See {@link KeyboardIconsSet} about icon_name.
|
* See {@link KeyboardIconsSet} about icon_name.
|
||||||
|
@ -52,7 +53,7 @@ public class KeySpecParser {
|
||||||
private static final char SUFFIX_SLASH = '/';
|
private static final char SUFFIX_SLASH = '/';
|
||||||
private static final String PREFIX_STRING = PREFIX_AT + "string" + SUFFIX_SLASH;
|
private static final String PREFIX_STRING = PREFIX_AT + "string" + SUFFIX_SLASH;
|
||||||
private static final char LABEL_END = '|';
|
private static final char LABEL_END = '|';
|
||||||
private static final String PREFIX_ICON = PREFIX_AT + "icon" + SUFFIX_SLASH;
|
private static final String PREFIX_ICON = "!icon/";
|
||||||
private static final String PREFIX_CODE = "!code/";
|
private static final String PREFIX_CODE = "!code/";
|
||||||
private static final String PREFIX_HEX = "0x";
|
private static final String PREFIX_HEX = "0x";
|
||||||
private static final String ADDITIONAL_MORE_KEY_MARKER = "%";
|
private static final String ADDITIONAL_MORE_KEY_MARKER = "%";
|
||||||
|
|
|
@ -33,9 +33,9 @@ public class KeySpecParserTests extends AndroidTestCase {
|
||||||
private static final String ICON_SETTINGS_NAME = "settingsKey";
|
private static final String ICON_SETTINGS_NAME = "settingsKey";
|
||||||
|
|
||||||
private static final String CODE_SETTINGS = "!code/" + CODE_SETTINGS_NAME;
|
private static final String CODE_SETTINGS = "!code/" + CODE_SETTINGS_NAME;
|
||||||
private static final String ICON_SETTINGS = "@icon/" + ICON_SETTINGS_NAME;
|
private static final String ICON_SETTINGS = "!icon/" + ICON_SETTINGS_NAME;
|
||||||
private static final String CODE_NON_EXISTING = "!code/non_existing";
|
private static final String CODE_NON_EXISTING = "!code/non_existing";
|
||||||
private static final String ICON_NON_EXISTING = "@icon/non_existing";
|
private static final String ICON_NON_EXISTING = "!icon/non_existing";
|
||||||
|
|
||||||
private int mCodeSettings;
|
private int mCodeSettings;
|
||||||
private int mSettingsIconId;
|
private int mSettingsIconId;
|
||||||
|
|
Loading…
Reference in New Issue