Use string attribute for icon name
Change-Id: I336acf33c7e6bc993b9da9b17ec689975fa8127dmain
parent
050b577bfb
commit
cf41aff251
|
@ -209,20 +209,21 @@
|
|||
<attr name="verticalGap" format="dimension|fraction" />
|
||||
<!-- More keys keyboard layout template -->
|
||||
<attr name="moreKeysTemplate" format="reference" />
|
||||
<!-- Icon set for key top and key preview. -->
|
||||
<!-- Icon set for key top and key preview.
|
||||
These should be aligned with KeyboardIconsSet.NAMES_AND_ATTR_IDS[] -->
|
||||
<attr name="iconShiftKey" format="reference" />
|
||||
<attr name="iconDeleteKey" format="reference" />
|
||||
<attr name="iconSettingsKey" format="reference" />
|
||||
<attr name="iconSpaceKey" format="reference" />
|
||||
<attr name="iconReturnKey" format="reference" />
|
||||
<attr name="iconEnterKey" format="reference" />
|
||||
<attr name="iconSearchKey" format="reference" />
|
||||
<attr name="iconTabKey" format="reference" />
|
||||
<attr name="iconShortcutKey" format="reference" />
|
||||
<attr name="iconShortcutForLabel" format="reference" />
|
||||
<attr name="iconSpaceKeyForNumberLayout" format="reference" />
|
||||
<attr name="iconShiftKeyShifted" format="reference" />
|
||||
<attr name="iconDisabledShortcutKey" format="reference" />
|
||||
<attr name="iconPreviewTabKey" format="reference" />
|
||||
<attr name="iconShortcutKeyDisabled" format="reference" />
|
||||
<attr name="iconTabKeyPreview" format="reference" />
|
||||
<attr name="iconLanguageSwitchKey" format="reference" />
|
||||
<attr name="iconZwnjKey" format="reference" />
|
||||
<attr name="iconZwjKey" format="reference" />
|
||||
|
@ -301,37 +302,11 @@
|
|||
<flag name="disableAdditionalMoreKeys" value="0x80000000" />
|
||||
</attr>
|
||||
<!-- The icon to display on the key instead of the label. -->
|
||||
<!-- TODO: Use string format !icon/name. -->
|
||||
<attr name="keyIcon" format="enum">
|
||||
<!-- This should be aligned with the KeyboardIconsSet.ICON_* -->
|
||||
<enum name="iconUndefined" value="0" />
|
||||
<enum name="iconShiftKey" value="1" />
|
||||
<enum name="iconDeleteKey" value="2" />
|
||||
<enum name="iconSettingsKey" value="3" />
|
||||
<enum name="iconSpaceKey" value="4" />
|
||||
<enum name="iconReturnKey" value="5" />
|
||||
<enum name="iconSearchKey" value="6" />
|
||||
<enum name="iconTabKey" value="7" />
|
||||
<enum name="iconShortcutKey" value="8" />
|
||||
<enum name="iconShortcutForLabel" value="9" />
|
||||
<enum name="iconSpaceKeyForNumberLayout" value="10" />
|
||||
<enum name="iconShiftKeyShifted" value="11" />
|
||||
<enum name="iconLanguageSwitchKey" value="14" />
|
||||
<enum name="iconZwnjKey" value="15" />
|
||||
<enum name="iconZwjKey" value="16" />
|
||||
</attr>
|
||||
<attr name="keyIcon" format="string" />
|
||||
<!-- The icon for disabled key -->
|
||||
<!-- TODO: Use string format !icon/name. -->
|
||||
<attr name="keyIconDisabled" format="enum">
|
||||
<!-- This should be aligned with the KeyboardIconsSet.ICON_* -->
|
||||
<enum name="iconDisabledShortcutKey" value="12" />
|
||||
</attr>
|
||||
<attr name="keyIconDisabled" format="string" />
|
||||
<!-- The icon to show in the popup preview. -->
|
||||
<!-- TODO: Use string format !icon/name. -->
|
||||
<attr name="keyIconPreview" format="enum">
|
||||
<!-- This should be aligned with the KeyboardIconsSet.ICON_* -->
|
||||
<enum name="iconPreviewTabKey" value="13" />
|
||||
</attr>
|
||||
<attr name="keyIconPreview" format="string" />
|
||||
<!-- The key style to specify a set of key attributes defined by <key_style/> -->
|
||||
<attr name="keyStyle" format="string" />
|
||||
<!-- Visual insets -->
|
||||
|
|
|
@ -25,15 +25,15 @@
|
|||
<item name="iconDeleteKey">@drawable/sym_bkeyboard_delete</item>
|
||||
<item name="iconSettingsKey">@drawable/sym_bkeyboard_settings</item>
|
||||
<item name="iconSpaceKey">@drawable/sym_bkeyboard_space</item>
|
||||
<item name="iconReturnKey">@drawable/sym_bkeyboard_return</item>
|
||||
<item name="iconEnterKey">@drawable/sym_bkeyboard_return</item>
|
||||
<item name="iconSearchKey">@drawable/sym_bkeyboard_search</item>
|
||||
<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="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>
|
||||
<item name="iconShortcutKeyDisabled">@drawable/sym_bkeyboard_voice_off</item>
|
||||
<item name="iconTabKeyPreview">@drawable/sym_keyboard_feedback_tab</item>
|
||||
<!-- TODO: Needs dedicated black theme globe icon -->
|
||||
<item name="iconLanguageSwitchKey">@drawable/sym_keyboard_language_switch</item>
|
||||
<!-- TODO: Needs dedicated black theme ZWNJ and ZWJ icons -->
|
||||
|
|
|
@ -24,15 +24,15 @@
|
|||
<item name="iconDeleteKey">@drawable/sym_keyboard_delete_holo</item>
|
||||
<item name="iconSettingsKey">@drawable/sym_keyboard_settings_holo</item>
|
||||
<item name="iconSpaceKey">@null</item>
|
||||
<item name="iconReturnKey">@drawable/sym_keyboard_return_holo</item>
|
||||
<item name="iconEnterKey">@drawable/sym_keyboard_return_holo</item>
|
||||
<item name="iconSearchKey">@drawable/sym_keyboard_search_holo</item>
|
||||
<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="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>
|
||||
<item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_holo</item>
|
||||
<item name="iconTabKeyPreview">@drawable/sym_keyboard_feedback_tab</item>
|
||||
<item name="iconLanguageSwitchKey">@drawable/sym_keyboard_language_switch</item>
|
||||
<item name="iconZwnjKey">@drawable/sym_keyboard_zwnj_holo</item>
|
||||
<item name="iconZwjKey">@drawable/sym_keyboard_zwj_holo</item>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<item name="iconDeleteKey">@drawable/sym_keyboard_delete</item>
|
||||
<item name="iconSettingsKey">@drawable/sym_keyboard_settings</item>
|
||||
<item name="iconSpaceKey">@drawable/sym_keyboard_space</item>
|
||||
<item name="iconReturnKey">@drawable/sym_keyboard_return</item>
|
||||
<item name="iconEnterKey">@drawable/sym_keyboard_return</item>ZZ
|
||||
<item name="iconSearchKey">@drawable/sym_keyboard_search</item>
|
||||
<item name="iconTabKey">@drawable/sym_keyboard_tab</item>
|
||||
<item name="iconShortcutKey">@drawable/sym_keyboard_mic</item>
|
||||
|
@ -29,8 +29,8 @@
|
|||
<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>
|
||||
<item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_holo</item>
|
||||
<item name="iconTabKeyPreview">@drawable/sym_keyboard_feedback_tab</item>
|
||||
<item name="iconLanguageSwitchKey">@drawable/sym_keyboard_language_switch</item>
|
||||
<!-- TODO: Needs dedicated black theme ZWNJ and ZWJ icons -->
|
||||
<item name="iconZwnjKey">@drawable/sym_keyboard_zwnj_holo</item>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<key-style
|
||||
latin:styleName="shiftKeyStyle"
|
||||
latin:code="!code/key_shift"
|
||||
latin:keyIcon="iconShiftKeyShifted"
|
||||
latin:keyIcon="!icon/shift_key_shifted"
|
||||
latin:keyActionFlags="noKeyPreview"
|
||||
latin:backgroundType="stickyOff" />
|
||||
</case>
|
||||
|
@ -53,7 +53,7 @@
|
|||
<key-style
|
||||
latin:styleName="shiftKeyStyle"
|
||||
latin:code="!code/key_shift"
|
||||
latin:keyIcon="iconShiftKeyShifted"
|
||||
latin:keyIcon="!icon/shift_key_shifted"
|
||||
latin:keyActionFlags="noKeyPreview"
|
||||
latin:backgroundType="stickyOn" />
|
||||
</case>
|
||||
|
@ -61,7 +61,7 @@
|
|||
<key-style
|
||||
latin:styleName="shiftKeyStyle"
|
||||
latin:code="!code/key_shift"
|
||||
latin:keyIcon="iconShiftKey"
|
||||
latin:keyIcon="!icon/shift_key"
|
||||
latin:keyActionFlags="noKeyPreview"
|
||||
latin:backgroundType="stickyOff" />
|
||||
</default>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<key-style
|
||||
latin:styleName="deleteKeyStyle"
|
||||
latin:code="!code/key_delete"
|
||||
latin:keyIcon="iconDeleteKey"
|
||||
latin:keyIcon="!icon/delete_key"
|
||||
latin:keyActionFlags="isRepeatable|noKeyPreview"
|
||||
latin:backgroundType="functional" />
|
||||
<include
|
||||
|
@ -83,8 +83,8 @@
|
|||
<key-style
|
||||
latin:styleName="zwnjKeyStyle"
|
||||
latin:code="0x200C"
|
||||
latin:keyIcon="iconZwnjKey"
|
||||
latin:moreKeys="!icon/zwjKey|‍"
|
||||
latin:keyIcon="!icon/zwnj_key"
|
||||
latin:moreKeys="!icon/zwj_key|‍"
|
||||
latin:keyLabelFlags="hasPopupHint"
|
||||
latin:keyActionFlags="noKeyPreview" />
|
||||
<key-style
|
||||
|
@ -96,14 +96,14 @@
|
|||
<key-style
|
||||
latin:styleName="shortcutKeyStyle"
|
||||
latin:code="!code/key_shortcut"
|
||||
latin:keyIcon="iconShortcutKey"
|
||||
latin:keyIconDisabled="iconDisabledShortcutKey"
|
||||
latin:keyIcon="!icon/shortcut_key"
|
||||
latin:keyIconDisabled="!icon/shortcut_key_disabled"
|
||||
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
|
||||
latin:backgroundType="functional" />
|
||||
<key-style
|
||||
latin:styleName="settingsKeyStyle"
|
||||
latin:code="!code/key_settings"
|
||||
latin:keyIcon="iconSettingsKey"
|
||||
latin:keyIcon="!icon/settings_key"
|
||||
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
|
||||
latin:backgroundType="functional" />
|
||||
<switch>
|
||||
|
@ -114,16 +114,16 @@
|
|||
<key-style
|
||||
latin:styleName="tabKeyStyle"
|
||||
latin:code="!code/key_action_previous"
|
||||
latin:keyIcon="iconTabKey"
|
||||
latin:keyIconPreview="iconPreviewTabKey"
|
||||
latin:keyIcon="!icon/tab_key"
|
||||
latin:keyIconPreview="!icon/tab_key_preview"
|
||||
latin:backgroundType="functional" />
|
||||
</case>
|
||||
<default>
|
||||
<key-style
|
||||
latin:styleName="tabKeyStyle"
|
||||
latin:code="!code/key_tab"
|
||||
latin:keyIcon="iconTabKey"
|
||||
latin:keyIconPreview="iconPreviewTabKey"
|
||||
latin:keyIcon="!icon/tab_key"
|
||||
latin:keyIconPreview="!icon/tab_key_preview"
|
||||
latin:backgroundType="functional" />
|
||||
</default>
|
||||
</switch>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<key-style
|
||||
latin:styleName="shiftKeyStyle"
|
||||
latin:code="!code/key_shift"
|
||||
latin:keyIcon="iconShiftKeyShifted"
|
||||
latin:keyIcon="!icon/shift_key_shifted"
|
||||
latin:keyActionFlags="noKeyPreview"
|
||||
latin:backgroundType="stickyOff" />
|
||||
</case>
|
||||
|
@ -52,7 +52,7 @@
|
|||
<key-style
|
||||
latin:styleName="shiftKeyStyle"
|
||||
latin:code="!code/key_shift"
|
||||
latin:keyIcon="iconShiftKeyShifted"
|
||||
latin:keyIcon="!icon/shift_key_shifted"
|
||||
latin:keyActionFlags="noKeyPreview"
|
||||
latin:backgroundType="stickyOn" />
|
||||
</case>
|
||||
|
@ -60,7 +60,7 @@
|
|||
<key-style
|
||||
latin:styleName="shiftKeyStyle"
|
||||
latin:code="!code/key_shift"
|
||||
latin:keyIcon="iconShiftKey"
|
||||
latin:keyIcon="!icon/shift_key"
|
||||
latin:keyActionFlags="noKeyPreview"
|
||||
latin:backgroundType="stickyOff" />
|
||||
</default>
|
||||
|
@ -68,7 +68,7 @@
|
|||
<key-style
|
||||
latin:styleName="deleteKeyStyle"
|
||||
latin:code="!code/key_delete"
|
||||
latin:keyIcon="iconDeleteKey"
|
||||
latin:keyIcon="!icon/delete_key"
|
||||
latin:keyActionFlags="isRepeatable|noKeyPreview"
|
||||
latin:backgroundType="functional" />
|
||||
<include
|
||||
|
@ -82,8 +82,8 @@
|
|||
<key-style
|
||||
latin:styleName="zwnjKeyStyle"
|
||||
latin:code="0x200C"
|
||||
latin:keyIcon="iconZwnjKey"
|
||||
latin:moreKeys="!icon/zwjKey|‍"
|
||||
latin:keyIcon="!icon/zwnj_key"
|
||||
latin:moreKeys="!icon/zwj_key|‍"
|
||||
latin:keyLabelFlags="hasPopupHint"
|
||||
latin:keyActionFlags="noKeyPreview" />
|
||||
<key-style
|
||||
|
@ -95,14 +95,14 @@
|
|||
<key-style
|
||||
latin:styleName="shortcutKeyStyle"
|
||||
latin:code="!code/key_shortcut"
|
||||
latin:keyIcon="iconShortcutKey"
|
||||
latin:keyIconDisabled="iconDisabledShortcutKey"
|
||||
latin:keyIcon="!icon/shortcut_key"
|
||||
latin:keyIconDisabled="!icon/shortcut_key_disabled"
|
||||
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
|
||||
latin:backgroundType="functional" />
|
||||
<key-style
|
||||
latin:styleName="settingsKeyStyle"
|
||||
latin:code="!code/key_settings"
|
||||
latin:keyIcon="iconSettingsKey"
|
||||
latin:keyIcon="!icon/settings_key"
|
||||
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
|
||||
latin:backgroundType="functional" />
|
||||
<switch>
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<key-style
|
||||
latin:styleName="shiftKeyStyle"
|
||||
latin:code="!code/key_shift"
|
||||
latin:keyIcon="iconShiftKeyShifted"
|
||||
latin:keyIcon="!icon/shift_key_shifted"
|
||||
latin:keyActionFlags="noKeyPreview"
|
||||
latin:backgroundType="stickyOff" />
|
||||
</case>
|
||||
|
@ -57,7 +57,7 @@
|
|||
<key-style
|
||||
latin:styleName="shiftKeyStyle"
|
||||
latin:code="!code/key_shift"
|
||||
latin:keyIcon="iconShiftKeyShifted"
|
||||
latin:keyIcon="!icon/shift_key_shifted"
|
||||
latin:keyActionFlags="noKeyPreview"
|
||||
latin:backgroundType="stickyOn" />
|
||||
</case>
|
||||
|
@ -65,7 +65,7 @@
|
|||
<key-style
|
||||
latin:styleName="shiftKeyStyle"
|
||||
latin:code="!code/key_shift"
|
||||
latin:keyIcon="iconShiftKey"
|
||||
latin:keyIcon="!icon/shift_key"
|
||||
latin:keyActionFlags="noKeyPreview"
|
||||
latin:backgroundType="stickyOff" />
|
||||
</default>
|
||||
|
@ -73,7 +73,7 @@
|
|||
<key-style
|
||||
latin:styleName="deleteKeyStyle"
|
||||
latin:code="!code/key_delete"
|
||||
latin:keyIcon="iconDeleteKey"
|
||||
latin:keyIcon="!icon/delete_key"
|
||||
latin:keyActionFlags="isRepeatable|noKeyPreview"
|
||||
latin:backgroundType="functional" />
|
||||
<include
|
||||
|
@ -112,39 +112,39 @@
|
|||
<key-style
|
||||
latin:styleName="zwnjKeyStyle"
|
||||
latin:code="0x200C"
|
||||
latin:keyIcon="iconZwnjKey"
|
||||
latin:moreKeys="!icon/zwjKey|‍"
|
||||
latin:keyIcon="!icon/zwnj_key"
|
||||
latin:moreKeys="!icon/zwj_key|‍"
|
||||
latin:keyLabelFlags="hasPopupHint"
|
||||
latin:keyActionFlags="noKeyPreview"
|
||||
latin:backgroundType="functional" />
|
||||
<key-style
|
||||
latin:styleName="shortcutKeyStyle"
|
||||
latin:code="!code/key_shortcut"
|
||||
latin:keyIcon="iconShortcutKey"
|
||||
latin:keyIconDisabled="iconDisabledShortcutKey"
|
||||
latin:keyIcon="!icon/shortcut_key"
|
||||
latin:keyIconDisabled="!icon/shortcut_key_disabled"
|
||||
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
|
||||
latin:altCode="!code/key_space"
|
||||
latin:parentStyle="f1MoreKeysStyle" />
|
||||
<key-style
|
||||
latin:styleName="languageSwitchKeyStyle"
|
||||
latin:code="!code/key_language_switch"
|
||||
latin:keyIcon="iconLanguageSwitchKey"
|
||||
latin:keyIcon="!icon/language_switch_key"
|
||||
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping|enableLongPress"
|
||||
latin:altCode="!code/key_space"
|
||||
latin:backgroundType="functional" />
|
||||
<key-style
|
||||
latin:styleName="tabKeyStyle"
|
||||
latin:code="!code/key_tab"
|
||||
latin:keyIcon="iconTabKey"
|
||||
latin:keyIconPreview="iconPreviewTabKey"
|
||||
latin:keyIcon="!icon/tab_key"
|
||||
latin:keyIconPreview="!icon/tab_key_preview"
|
||||
latin:backgroundType="functional" />
|
||||
<!-- Note: This key style is not for functional tab key. This is used for the tab key which is
|
||||
laid out as normal letter key. -->
|
||||
<key-style
|
||||
latin:styleName="nonSpecialBackgroundTabKeyStyle"
|
||||
latin:code="!code/key_tab"
|
||||
latin:keyIcon="iconTabKey"
|
||||
latin:keyIconPreview="iconPreviewTabKey" />
|
||||
latin:keyIcon="!icon/tab_key"
|
||||
latin:keyIconPreview="!icon/tab_key_preview" />
|
||||
<switch>
|
||||
<!-- When this qwerty keyboard has no shortcut keys but shortcut key is enabled, then symbol
|
||||
keyboard will have a shortcut key. That means we should use
|
||||
|
@ -156,7 +156,7 @@
|
|||
<key-style
|
||||
latin:styleName="toSymbolKeyStyle"
|
||||
latin:code="!code/key_switch_alpha_symbol"
|
||||
latin:keyIcon="iconShortcutForLabel"
|
||||
latin:keyIcon="!icon/shortcut_for_label"
|
||||
latin:keyLabel="!label/label_to_symbol_with_microphone_key"
|
||||
latin:keyLabelFlags="withIconRight"
|
||||
latin:keyActionFlags="noKeyPreview"
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
<key-style
|
||||
latin:styleName="defaultEnterKeyStyle"
|
||||
latin:code="!code/key_enter"
|
||||
latin:keyIcon="iconReturnKey"
|
||||
latin:keyIcon="!icon/enter_key"
|
||||
latin:keyLabelFlags="autoXScale|followKeyLabelRatio"
|
||||
latin:keyActionFlags="noKeyPreview"
|
||||
latin:backgroundType="functional"
|
||||
|
@ -101,7 +101,7 @@
|
|||
<key-style
|
||||
latin:styleName="defaultActionKeyStyle"
|
||||
latin:code="!code/key_action_enter"
|
||||
latin:keyIcon="iconUndefined"
|
||||
latin:keyIcon="!icon/undefined"
|
||||
latin:backgroundType="action"
|
||||
latin:parentStyle="defaultEnterKeyStyle" />
|
||||
<switch>
|
||||
|
@ -159,7 +159,7 @@
|
|||
>
|
||||
<key-style
|
||||
latin:styleName="enterKeyStyle"
|
||||
latin:keyIcon="iconSearchKey"
|
||||
latin:keyIcon="!icon/search_key"
|
||||
latin:parentStyle="defaultActionKeyStyle" />
|
||||
</case>
|
||||
<case
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
<key-style
|
||||
latin:styleName="numSpaceKeyStyle"
|
||||
latin:code="!code/key_space"
|
||||
latin:keyIcon="iconSpaceKeyForNumberLayout"
|
||||
latin:keyIcon="!icon/space_key_for_number_layout"
|
||||
latin:keyActionFlags="enableLongPress"
|
||||
latin:parentStyle="numKeyBaseStyle" />
|
||||
</merge>
|
||||
|
|
|
@ -16,6 +16,12 @@
|
|||
|
||||
package com.android.inputmethod.keyboard;
|
||||
|
||||
import static com.android.inputmethod.keyboard.Keyboard.CODE_OUTPUT_TEXT;
|
||||
import static com.android.inputmethod.keyboard.Keyboard.CODE_SHIFT;
|
||||
import static com.android.inputmethod.keyboard.Keyboard.CODE_SWITCH_ALPHA_SYMBOL;
|
||||
import static com.android.inputmethod.keyboard.Keyboard.CODE_UNSPECIFIED;
|
||||
import static com.android.inputmethod.keyboard.internal.KeyboardIconsSet.ICON_UNDEFINED;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Rect;
|
||||
|
@ -170,11 +176,11 @@ public class Key {
|
|||
mLabel = label;
|
||||
mOutputText = outputText;
|
||||
mCode = code;
|
||||
mEnabled = (code != Keyboard.CODE_UNSPECIFIED);
|
||||
mAltCode = Keyboard.CODE_UNSPECIFIED;
|
||||
mEnabled = (code != CODE_UNSPECIFIED);
|
||||
mAltCode = CODE_UNSPECIFIED;
|
||||
mIconId = iconId;
|
||||
mDisabledIconId = KeyboardIconsSet.ICON_UNDEFINED;
|
||||
mPreviewIconId = KeyboardIconsSet.ICON_UNDEFINED;
|
||||
mDisabledIconId = ICON_UNDEFINED;
|
||||
mPreviewIconId = ICON_UNDEFINED;
|
||||
// Horizontal gap is divided equally to both sides of the key.
|
||||
mX = x + mHorizontalGap / 2;
|
||||
mY = y;
|
||||
|
@ -208,9 +214,9 @@ public class Key {
|
|||
if (keyAttr.hasValue(R.styleable.Keyboard_Key_keyStyle)) {
|
||||
String styleName = keyAttr.getString(R.styleable.Keyboard_Key_keyStyle);
|
||||
style = keyStyles.getKeyStyle(styleName);
|
||||
if (style == null)
|
||||
throw new XmlParseUtils.ParseException(
|
||||
"Unknown key style: " + styleName, parser);
|
||||
if (style == null) {
|
||||
throw new XmlParseUtils.ParseException("Unknown key style: " + styleName, parser);
|
||||
}
|
||||
} else {
|
||||
style = keyStyles.getEmptyKeyStyle();
|
||||
}
|
||||
|
@ -235,12 +241,12 @@ public class Key {
|
|||
R.styleable.Keyboard_Key_visualInsetsLeft, params.mBaseWidth, 0);
|
||||
mVisualInsetsRight = (int) Keyboard.Builder.getDimensionOrFraction(keyAttr,
|
||||
R.styleable.Keyboard_Key_visualInsetsRight, params.mBaseWidth, 0);
|
||||
mPreviewIconId = style.getInt(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyIconPreview, KeyboardIconsSet.ICON_UNDEFINED);
|
||||
mIconId = style.getInt(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyIcon, KeyboardIconsSet.ICON_UNDEFINED);
|
||||
mDisabledIconId = style.getInt(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyIconDisabled, KeyboardIconsSet.ICON_UNDEFINED);
|
||||
mIconId = KeySpecParser.getIconId(style.getString(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyIcon));
|
||||
mDisabledIconId = KeySpecParser.getIconId(style.getString(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyIconDisabled));
|
||||
mPreviewIconId = KeySpecParser.getIconId(style.getString(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyIconPreview));
|
||||
|
||||
mLabelFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags)
|
||||
| row.getDefaultKeyLabelFlags();
|
||||
|
@ -272,8 +278,8 @@ public class Key {
|
|||
if ((mLabelFlags & LABEL_FLAGS_DISABLE_ADDITIONAL_MORE_KEYS) != 0) {
|
||||
additionalMoreKeys = null;
|
||||
} else {
|
||||
additionalMoreKeys = style.getStringArray(
|
||||
keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys);
|
||||
additionalMoreKeys = style.getStringArray(keyAttr,
|
||||
R.styleable.Keyboard_Key_additionalMoreKeys);
|
||||
}
|
||||
moreKeys = KeySpecParser.insertAdditionalMoreKeys(moreKeys, additionalMoreKeys);
|
||||
if (moreKeys != null) {
|
||||
|
@ -291,22 +297,21 @@ public class Key {
|
|||
if ((mLabelFlags & LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL) != 0) {
|
||||
mLabel = params.mId.mCustomActionLabel;
|
||||
} else {
|
||||
mLabel = adjustCaseOfStringForKeyboardId(style.getString(
|
||||
keyAttr, R.styleable.Keyboard_Key_keyLabel), preserveCase, params.mId);
|
||||
mLabel = adjustCaseOfStringForKeyboardId(style.getString(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyLabel), preserveCase, params.mId);
|
||||
}
|
||||
if ((mLabelFlags & LABEL_FLAGS_DISABLE_HINT_LABEL) != 0) {
|
||||
mHintLabel = null;
|
||||
} else {
|
||||
mHintLabel = adjustCaseOfStringForKeyboardId(style.getString(
|
||||
keyAttr, R.styleable.Keyboard_Key_keyHintLabel), preserveCase, params.mId);
|
||||
mHintLabel = adjustCaseOfStringForKeyboardId(style.getString(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyHintLabel), preserveCase, params.mId);
|
||||
}
|
||||
String outputText = adjustCaseOfStringForKeyboardId(style.getString(
|
||||
keyAttr, R.styleable.Keyboard_Key_keyOutputText), preserveCase, params.mId);
|
||||
final int code = KeySpecParser.parseCode(style.getString(
|
||||
keyAttr, R.styleable.Keyboard_Key_code),
|
||||
params.mCodesSet, Keyboard.CODE_UNSPECIFIED);
|
||||
String outputText = adjustCaseOfStringForKeyboardId(style.getString(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyOutputText), preserveCase, params.mId);
|
||||
final int code = KeySpecParser.parseCode(style.getString(keyAttr,
|
||||
R.styleable.Keyboard_Key_code), params.mCodesSet, CODE_UNSPECIFIED);
|
||||
// Choose the first letter of the label as primary code if not specified.
|
||||
if (code == Keyboard.CODE_UNSPECIFIED && TextUtils.isEmpty(outputText)
|
||||
if (code == CODE_UNSPECIFIED && TextUtils.isEmpty(outputText)
|
||||
&& !TextUtils.isEmpty(mLabel)) {
|
||||
if (StringUtils.codePointCount(mLabel) == 1) {
|
||||
// Use the first letter of the hint label if shiftedLetterActivated flag is
|
||||
|
@ -321,22 +326,21 @@ public class Key {
|
|||
// In some locale and case, the character might be represented by multiple code
|
||||
// points, such as upper case Eszett of German alphabet.
|
||||
outputText = mLabel;
|
||||
mCode = Keyboard.CODE_OUTPUT_TEXT;
|
||||
mCode = CODE_OUTPUT_TEXT;
|
||||
}
|
||||
} else if (code == Keyboard.CODE_UNSPECIFIED && outputText != null) {
|
||||
} else if (code == CODE_UNSPECIFIED && outputText != null) {
|
||||
if (StringUtils.codePointCount(outputText) == 1) {
|
||||
mCode = outputText.codePointAt(0);
|
||||
outputText = null;
|
||||
} else {
|
||||
mCode = Keyboard.CODE_OUTPUT_TEXT;
|
||||
mCode = CODE_OUTPUT_TEXT;
|
||||
}
|
||||
} else {
|
||||
mCode = adjustCaseOfCodeForKeyboardId(code, preserveCase, params.mId);
|
||||
}
|
||||
mOutputText = outputText;
|
||||
mAltCode = adjustCaseOfCodeForKeyboardId(KeySpecParser.parseCode(style.getString(
|
||||
keyAttr, R.styleable.Keyboard_Key_altCode),
|
||||
params.mCodesSet, Keyboard.CODE_UNSPECIFIED),
|
||||
mAltCode = adjustCaseOfCodeForKeyboardId(KeySpecParser.parseCode(style.getString(keyAttr,
|
||||
R.styleable.Keyboard_Key_altCode), params.mCodesSet, CODE_UNSPECIFIED),
|
||||
preserveCase, params.mId);
|
||||
mHashCode = computeHashCode(this);
|
||||
|
||||
|
@ -353,7 +357,7 @@ public class Key {
|
|||
final String text = new String(new int[] { code } , 0, 1);
|
||||
final String casedText = adjustCaseOfStringForKeyboardId(text, preserveCase, id);
|
||||
return StringUtils.codePointCount(casedText) == 1
|
||||
? casedText.codePointAt(0) : Keyboard.CODE_UNSPECIFIED;
|
||||
? casedText.codePointAt(0) : CODE_UNSPECIFIED;
|
||||
}
|
||||
|
||||
private static String adjustCaseOfStringForKeyboardId(String text, boolean preserveCase,
|
||||
|
@ -463,11 +467,11 @@ public class Key {
|
|||
}
|
||||
|
||||
public boolean isShift() {
|
||||
return mCode == Keyboard.CODE_SHIFT;
|
||||
return mCode == CODE_SHIFT;
|
||||
}
|
||||
|
||||
public boolean isModifier() {
|
||||
return mCode == Keyboard.CODE_SHIFT || mCode == Keyboard.CODE_SWITCH_ALPHA_SYMBOL;
|
||||
return mCode == CODE_SHIFT || mCode == CODE_SWITCH_ALPHA_SYMBOL;
|
||||
}
|
||||
|
||||
public boolean isRepeatable() {
|
||||
|
@ -586,7 +590,7 @@ public class Key {
|
|||
}
|
||||
|
||||
public Drawable getPreviewIcon(KeyboardIconsSet iconSet) {
|
||||
return mPreviewIconId != KeyboardIconsSet.ICON_UNDEFINED
|
||||
return mPreviewIconId != ICON_UNDEFINED
|
||||
? iconSet.getIconDrawable(mPreviewIconId)
|
||||
: iconSet.getIconDrawable(mIconId);
|
||||
}
|
||||
|
@ -726,7 +730,7 @@ public class Key {
|
|||
* This constructor is being used only for divider in more keys keyboard.
|
||||
*/
|
||||
protected Spacer(Keyboard.Params params, int x, int y, int width, int height) {
|
||||
super(params, null, null, KeyboardIconsSet.ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED,
|
||||
super(params, null, null, ICON_UNDEFINED, CODE_UNSPECIFIED,
|
||||
null, x, y, width, height, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,14 +76,7 @@ public class KeySpecParser {
|
|||
}
|
||||
|
||||
private static boolean hasIcon(String moreKeySpec) {
|
||||
if (moreKeySpec.regionMatches(true, 0, PREFIX_ICON, 0, PREFIX_ICON.length())) {
|
||||
final int end = indexOfLabelEnd(moreKeySpec, 0);
|
||||
if (end > 0) {
|
||||
return true;
|
||||
}
|
||||
throw new KeySpecParserError("outputText or code not specified: " + moreKeySpec);
|
||||
}
|
||||
return false;
|
||||
return moreKeySpec.regionMatches(true, 0, PREFIX_ICON, 0, PREFIX_ICON.length());
|
||||
}
|
||||
|
||||
private static boolean hasCode(String moreKeySpec) {
|
||||
|
@ -219,10 +212,11 @@ public class KeySpecParser {
|
|||
}
|
||||
}
|
||||
|
||||
static int getIconId(String moreKeySpec) {
|
||||
if (hasIcon(moreKeySpec)) {
|
||||
public static int getIconId(String moreKeySpec) {
|
||||
if (moreKeySpec != null && hasIcon(moreKeySpec)) {
|
||||
final int end = moreKeySpec.indexOf(LABEL_END, PREFIX_ICON.length());
|
||||
final String name = moreKeySpec.substring(PREFIX_ICON.length(), end);
|
||||
final String name = (end < 0) ? moreKeySpec.substring(PREFIX_ICON.length())
|
||||
: moreKeySpec.substring(PREFIX_ICON.length(), end);
|
||||
return KeyboardIconsSet.getIconId(name);
|
||||
}
|
||||
return KeyboardIconsSet.ICON_UNDEFINED;
|
||||
|
|
|
@ -145,9 +145,9 @@ public class KeyStyles {
|
|||
readStringArray(keyAttr, R.styleable.Keyboard_Key_moreKeys);
|
||||
readStringArray(keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys);
|
||||
readFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags);
|
||||
readInt(keyAttr, R.styleable.Keyboard_Key_keyIcon);
|
||||
readInt(keyAttr, R.styleable.Keyboard_Key_keyIconDisabled);
|
||||
readInt(keyAttr, R.styleable.Keyboard_Key_keyIconPreview);
|
||||
readString(keyAttr, R.styleable.Keyboard_Key_keyIcon);
|
||||
readString(keyAttr, R.styleable.Keyboard_Key_keyIconDisabled);
|
||||
readString(keyAttr, R.styleable.Keyboard_Key_keyIconPreview);
|
||||
readInt(keyAttr, R.styleable.Keyboard_Key_maxMoreKeysColumn);
|
||||
readInt(keyAttr, R.styleable.Keyboard_Key_backgroundType);
|
||||
readFlag(keyAttr, R.styleable.Keyboard_Key_keyActionFlags);
|
||||
|
|
|
@ -28,48 +28,52 @@ import java.util.HashMap;
|
|||
public class KeyboardIconsSet {
|
||||
private static final String TAG = KeyboardIconsSet.class.getSimpleName();
|
||||
|
||||
// The value should be aligned with the enum value of Key.keyIcon.
|
||||
public static final int ICON_UNDEFINED = 0;
|
||||
private static final int NUM_ICONS = 16;
|
||||
|
||||
private final Drawable[] mIcons = new Drawable[NUM_ICONS + 1];
|
||||
private static final int ATTR_UNDEFINED = 0;
|
||||
|
||||
private static final HashMap<Integer, Integer> ATTR_ID_TO_ICON_ID
|
||||
= new HashMap<Integer, Integer>();
|
||||
|
||||
// Lower case icon name to icon id map.
|
||||
private static final HashMap<String, Integer> sLowerCaseNameToIdsMap =
|
||||
new HashMap<String, Integer>();
|
||||
private static final String[] ICON_NAMES = new String[NUM_ICONS + 1];
|
||||
|
||||
private static final int ATTR_UNDEFINED = 0;
|
||||
private static final Object[] NAMES_AND_ATTR_IDS = {
|
||||
"undefined", ATTR_UNDEFINED,
|
||||
"shift_key", R.styleable.Keyboard_iconShiftKey,
|
||||
"delete_key", R.styleable.Keyboard_iconDeleteKey,
|
||||
"settings_key", R.styleable.Keyboard_iconSettingsKey,
|
||||
"space_key", R.styleable.Keyboard_iconSpaceKey,
|
||||
"enter_key", R.styleable.Keyboard_iconEnterKey,
|
||||
"search_key", R.styleable.Keyboard_iconSearchKey,
|
||||
"tab_key", R.styleable.Keyboard_iconTabKey,
|
||||
"shortcut_key", R.styleable.Keyboard_iconShortcutKey,
|
||||
"shortcut_for_label", R.styleable.Keyboard_iconShortcutForLabel,
|
||||
"space_key_for_number_layout", R.styleable.Keyboard_iconSpaceKeyForNumberLayout,
|
||||
"shift_key_shifted", R.styleable.Keyboard_iconShiftKeyShifted,
|
||||
"shortcut_key_disabled", R.styleable.Keyboard_iconShortcutKeyDisabled,
|
||||
"tab_key_preview", R.styleable.Keyboard_iconTabKeyPreview,
|
||||
"language_switch_key", R.styleable.Keyboard_iconLanguageSwitchKey,
|
||||
"zwnj_key", R.styleable.Keyboard_iconZwnjKey,
|
||||
"zwj_key", R.styleable.Keyboard_iconZwjKey,
|
||||
};
|
||||
|
||||
private static int NUM_ICONS = NAMES_AND_ATTR_IDS.length / 2;
|
||||
private static final String[] ICON_NAMES = new String[NUM_ICONS];
|
||||
private final Drawable[] mIcons = new Drawable[NUM_ICONS];
|
||||
|
||||
static {
|
||||
// The key value should be aligned with the enum value of Key.keyIcon.
|
||||
addIconIdMap(0, "undefined", ATTR_UNDEFINED);
|
||||
addIconIdMap(1, "shiftKey", R.styleable.Keyboard_iconShiftKey);
|
||||
addIconIdMap(2, "deleteKey", R.styleable.Keyboard_iconDeleteKey);
|
||||
addIconIdMap(3, "settingsKey", R.styleable.Keyboard_iconSettingsKey);
|
||||
addIconIdMap(4, "spaceKey", R.styleable.Keyboard_iconSpaceKey);
|
||||
addIconIdMap(5, "returnKey", R.styleable.Keyboard_iconReturnKey);
|
||||
addIconIdMap(6, "searchKey", R.styleable.Keyboard_iconSearchKey);
|
||||
addIconIdMap(7, "tabKey", R.styleable.Keyboard_iconTabKey);
|
||||
addIconIdMap(8, "shortcutKey", R.styleable.Keyboard_iconShortcutKey);
|
||||
addIconIdMap(9, "shortcutForLabel", R.styleable.Keyboard_iconShortcutForLabel);
|
||||
addIconIdMap(10, "spaceKeyForNumberLayout",
|
||||
R.styleable.Keyboard_iconSpaceKeyForNumberLayout);
|
||||
addIconIdMap(11, "shiftKeyShifted", R.styleable.Keyboard_iconShiftKeyShifted);
|
||||
addIconIdMap(12, "disabledShortcurKey", R.styleable.Keyboard_iconDisabledShortcutKey);
|
||||
addIconIdMap(13, "previewTabKey", R.styleable.Keyboard_iconPreviewTabKey);
|
||||
addIconIdMap(14, "languageSwitchKey", R.styleable.Keyboard_iconLanguageSwitchKey);
|
||||
addIconIdMap(15, "zwnjKey", R.styleable.Keyboard_iconZwnjKey);
|
||||
addIconIdMap(16, "zwjKey", R.styleable.Keyboard_iconZwjKey);
|
||||
}
|
||||
|
||||
private static void addIconIdMap(int iconId, String name, int attrId) {
|
||||
if (attrId != ATTR_UNDEFINED) {
|
||||
ATTR_ID_TO_ICON_ID.put(attrId, iconId);
|
||||
int iconId = ICON_UNDEFINED;
|
||||
for (int i = 0; i < NAMES_AND_ATTR_IDS.length; i += 2) {
|
||||
final String name = (String)NAMES_AND_ATTR_IDS[i];
|
||||
final Integer attrId = (Integer)NAMES_AND_ATTR_IDS[i + 1];
|
||||
if (attrId != ATTR_UNDEFINED) {
|
||||
ATTR_ID_TO_ICON_ID.put(attrId, iconId);
|
||||
}
|
||||
sLowerCaseNameToIdsMap.put(name, iconId);
|
||||
ICON_NAMES[iconId] = name;
|
||||
iconId++;
|
||||
}
|
||||
sLowerCaseNameToIdsMap.put(name.toLowerCase(), iconId);
|
||||
ICON_NAMES[iconId] = name;
|
||||
}
|
||||
|
||||
public void loadIcons(final TypedArray keyboardAttrs) {
|
||||
|
@ -95,7 +99,7 @@ public class KeyboardIconsSet {
|
|||
return isValidIconId(iconId) ? ICON_NAMES[iconId] : "unknown<" + iconId + ">";
|
||||
}
|
||||
|
||||
public static int getIconId(final String name) {
|
||||
static int getIconId(final String name) {
|
||||
Integer iconId = sLowerCaseNameToIdsMap.get(name);
|
||||
if (iconId == null) {
|
||||
iconId = sLowerCaseNameToIdsMap.get(name.toLowerCase());
|
||||
|
|
|
@ -345,8 +345,8 @@ public final class KeyboardLabelsSet {
|
|||
// U+2663: "♣" BLACK CLUB SUIT
|
||||
/* 108 */ "\u266A,\u2665,\u2660,\u2666,\u2663",
|
||||
/* 109 */ "!fixedColumnOrder!2,!hasLabels!,!label/label_time_am,!label/label_time_pm",
|
||||
/* 110 */ "!icon/settingsKey|!code/key_settings",
|
||||
/* 111 */ "!icon/shortcutKey|!code/key_shortcut",
|
||||
/* 110 */ "!icon/settings_key|!code/key_settings",
|
||||
/* 111 */ "!icon/shortcut_key|!code/key_shortcut",
|
||||
/* 112 */ "!hasLabels!,!label/label_next_key|!code/key_action_next",
|
||||
/* 113 */ "!hasLabels!,!label/label_previous_key|!code/key_action_previous",
|
||||
// Label for "switch to more symbol" modifier key. Must be short to fit on key!
|
||||
|
|
|
@ -379,9 +379,9 @@ public class KeySpecParserCsvTests extends AndroidTestCase {
|
|||
"!fixedColumnOrder!2", "!hasLabels!", "AM", "PM");
|
||||
|
||||
assertTextArray("Settings as more key", "!label/settings_as_more_key",
|
||||
"!icon/settingsKey|!code/key_settings");
|
||||
"!icon/settings_key|!code/key_settings");
|
||||
assertTextArray("SETTINGS AS MORE KEY", "!LABEL/SETTINGS_AS_MORE_KEY",
|
||||
"!icon/settingsKey|!code/key_settings");
|
||||
"!icon/settings_key|!code/key_settings");
|
||||
|
||||
assertTextArray("Indirect naviagte actions as more key",
|
||||
"!label/indirect_navigate_actions_as_more_key",
|
||||
|
|
|
@ -22,6 +22,7 @@ import static com.android.inputmethod.keyboard.internal.KeyboardIconsSet.ICON_UN
|
|||
|
||||
import android.test.AndroidTestCase;
|
||||
|
||||
import com.android.inputmethod.keyboard.Keyboard;
|
||||
import com.android.inputmethod.keyboard.internal.KeySpecParser.MoreKeySpec;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -31,11 +32,8 @@ public class KeySpecParserTests extends AndroidTestCase {
|
|||
private final KeyboardCodesSet mCodesSet = new KeyboardCodesSet();
|
||||
private final KeyboardLabelsSet mLabelsSet = new KeyboardLabelsSet();
|
||||
|
||||
private static final String CODE_SETTINGS_NAME = "key_settings";
|
||||
private static final String ICON_SETTINGS_NAME = "settingsKey";
|
||||
|
||||
private static final String CODE_SETTINGS = "!code/" + CODE_SETTINGS_NAME;
|
||||
private static final String ICON_SETTINGS = "!icon/" + ICON_SETTINGS_NAME;
|
||||
private static final String CODE_SETTINGS = "!code/key_settings";
|
||||
private static final String ICON_SETTINGS = "!icon/settings_key";
|
||||
private static final String CODE_SETTINGS_UPPERCASE = CODE_SETTINGS.toUpperCase();
|
||||
private static final String ICON_SETTINGS_UPPERCASE = ICON_SETTINGS.toUpperCase();
|
||||
private static final String CODE_NON_EXISTING = "!code/non_existing";
|
||||
|
@ -54,19 +52,25 @@ public class KeySpecParserTests extends AndroidTestCase {
|
|||
mLabelsSet.setLanguage(language);
|
||||
mLabelsSet.loadStringResources(getContext());
|
||||
|
||||
mCodeSettings = mCodesSet.getCode(CODE_SETTINGS_NAME);
|
||||
mCodeActionNext = mCodesSet.getCode("key_action_next");
|
||||
mSettingsIconId = KeyboardIconsSet.getIconId(ICON_SETTINGS_NAME);
|
||||
mCodeSettings = KeySpecParser.parseCode(
|
||||
CODE_SETTINGS, mCodesSet, CODE_UNSPECIFIED);
|
||||
mCodeActionNext = KeySpecParser.parseCode(
|
||||
"!code/key_action_next", mCodesSet, CODE_UNSPECIFIED);
|
||||
mSettingsIconId = KeySpecParser.getIconId(ICON_SETTINGS);
|
||||
}
|
||||
|
||||
private void assertParser(String message, String moreKeySpec, String expectedLabel,
|
||||
String expectedOutputText, int expectedIcon, int expectedCode) {
|
||||
final MoreKeySpec spec = new MoreKeySpec(
|
||||
KeySpecParser.resolveLabelReference(moreKeySpec, mLabelsSet), mCodesSet);
|
||||
assertEquals(message + ": label:", expectedLabel, spec.mLabel);
|
||||
assertEquals(message + ": ouptputText:", expectedOutputText, spec.mOutputText);
|
||||
assertEquals(message + ": icon:", expectedIcon, spec.mIconId);
|
||||
assertEquals(message + ": codes value:", expectedCode, spec.mCode);
|
||||
final String labelResolved = KeySpecParser.resolveLabelReference(moreKeySpec, mLabelsSet);
|
||||
final MoreKeySpec spec = new MoreKeySpec(labelResolved, mCodesSet);
|
||||
assertEquals(message + " [label]", expectedLabel, spec.mLabel);
|
||||
assertEquals(message + " [ouptputText]", expectedOutputText, spec.mOutputText);
|
||||
assertEquals(message + " [icon]",
|
||||
KeyboardIconsSet.getIconName(expectedIcon),
|
||||
KeyboardIconsSet.getIconName(spec.mIconId));
|
||||
assertEquals(message + " [code]",
|
||||
Keyboard.printableCode(expectedCode),
|
||||
Keyboard.printableCode(spec.mCode));
|
||||
}
|
||||
|
||||
private void assertParserError(String message, String moreKeySpec, String expectedLabel,
|
||||
|
|
|
@ -181,8 +181,8 @@
|
|||
U+2663: "♣" BLACK CLUB SUIT -->
|
||||
<string name="more_keys_for_bullet">♪,♥,♠,♦,♣</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="shortcut_as_more_key">!icon/shortcutKey|!code/key_shortcut</string>
|
||||
<string name="settings_as_more_key">!icon/settings_key|!code/key_settings</string>
|
||||
<string name="shortcut_as_more_key">!icon/shortcut_key|!code/key_shortcut</string>
|
||||
<string name="action_next_as_more_key">!hasLabels!,\@string/label_next_key|!code/key_action_next</string>
|
||||
<string name="action_previous_as_more_key">!hasLabels!,\@string/label_previous_key|!code/key_action_previous</string>
|
||||
<!-- Label for "switch to more symbol" modifier key. Must be short to fit on key! -->
|
||||
|
|
Loading…
Reference in New Issue