Merge "Get rid of Keyboard.CODE_DUMMY"

main
Tadashi G. Takaoka 2012-01-10 01:52:53 -08:00 committed by Android (Google) Code Review
commit 2611d3d751
12 changed files with 70 additions and 72 deletions

View File

@ -23,10 +23,12 @@
<integer name="key_tab">9</integer> <integer name="key_tab">9</integer>
<integer name="key_return">10</integer> <integer name="key_return">10</integer>
<integer name="key_space">32</integer> <integer name="key_space">32</integer>
<integer name="key_dummy">0</integer>
<integer name="key_shift">-1</integer> <integer name="key_shift">-1</integer>
<integer name="key_switch_alpha_symbol">-2</integer> <integer name="key_switch_alpha_symbol">-2</integer>
<integer name="key_capslock">-3</integer>
<integer name="key_output_text">-4</integer>
<integer name="key_delete">-5</integer> <integer name="key_delete">-5</integer>
<integer name="key_settings">-6</integer> <integer name="key_settings">-6</integer>
<integer name="key_shortcut">-7</integer> <integer name="key_shortcut">-7</integer>
<integer name="key_unspecified">-9</integer>
</resources> </resources>

View File

@ -78,14 +78,12 @@
latin:keyIcon="iconShortcutKey" latin:keyIcon="iconShortcutKey"
latin:keyIconDisabled="iconDisabledShortcutKey" latin:keyIconDisabled="iconDisabledShortcutKey"
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping" latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
latin:altCode="@integer/key_dummy"
latin:parentStyle="f2PopupStyle" /> latin:parentStyle="f2PopupStyle" />
<key-style <key-style
latin:styleName="settingsKeyStyle" latin:styleName="settingsKeyStyle"
latin:code="@integer/key_settings" latin:code="@integer/key_settings"
latin:keyIcon="iconSettingsKey" latin:keyIcon="iconSettingsKey"
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping" latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
latin:altCode="@integer/key_dummy"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="tabKeyStyle" latin:styleName="tabKeyStyle"

View File

@ -60,14 +60,12 @@
latin:keyIcon="iconShortcutKey" latin:keyIcon="iconShortcutKey"
latin:keyIconDisabled="iconDisabledShortcutKey" latin:keyIconDisabled="iconDisabledShortcutKey"
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping" latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
latin:altCode="@integer/key_dummy"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="settingsKeyStyle" latin:styleName="settingsKeyStyle"
latin:code="@integer/key_settings" latin:code="@integer/key_settings"
latin:keyIcon="iconSettingsKey" latin:keyIcon="iconSettingsKey"
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping" latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
latin:altCode="@integer/key_dummy"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="tabKeyStyle" latin:styleName="tabKeyStyle"

View File

@ -26,10 +26,10 @@
latin:hasSettingsKey="true" latin:hasSettingsKey="true"
> >
<!-- Because this settings key is not adjacent to the space key, this key should be <!-- Because this settings key is not adjacent to the space key, this key should be
just ignored while typing (altCode=CODE_DUMMY). --> just ignored while typing (altCode=CODE_UNSPECIFIED). -->
<Key <Key
latin:keyStyle="settingsKeyStyle" latin:keyStyle="settingsKeyStyle"
latin:altCode="@integer/key_dummy" latin:altCode="@integer/key_unspecified"
latin:keyWidth="9.2%p" /> latin:keyWidth="9.2%p" />
</case> </case>
<!-- hasSettingsKey="false" --> <!-- hasSettingsKey="false" -->

View File

@ -142,7 +142,7 @@ public class KeyCodeDescriptionMapper {
} }
// Just attempt to speak the description. // Just attempt to speak the description.
if (key.mCode != Keyboard.CODE_DUMMY) { if (key.mCode != Keyboard.CODE_UNSPECIFIED) {
return getDescriptionForKeyCode(context, keyboard, key, shouldObscure); return getDescriptionForKeyCode(context, keyboard, key, shouldObscure);
} }

View File

@ -198,7 +198,7 @@ public class Key {
mLabel = label; mLabel = label;
mOutputText = outputText; mOutputText = outputText;
mCode = code; mCode = code;
mAltCode = Keyboard.CODE_DUMMY; mAltCode = Keyboard.CODE_UNSPECIFIED;
mIcon = icon; mIcon = icon;
mDisabledIcon = null; mDisabledIcon = null;
mPreviewIcon = null; mPreviewIcon = null;
@ -299,13 +299,13 @@ public class Key {
} }
final int firstChar = mLabel.charAt(0); final int firstChar = mLabel.charAt(0);
mCode = getRtlParenthesisCode(firstChar, params.mIsRtlKeyboard); mCode = getRtlParenthesisCode(firstChar, params.mIsRtlKeyboard);
} else if (code != Keyboard.CODE_UNSPECIFIED) { } else if (code == Keyboard.CODE_UNSPECIFIED && mOutputText != null) {
mCode = code; mCode = Keyboard.CODE_OUTPUT_TEXT;
} else { } else {
mCode = Keyboard.CODE_DUMMY; mCode = code;
} }
mAltCode = style.getInt(keyAttr, mAltCode = style.getInt(keyAttr,
R.styleable.Keyboard_Key_altCode, Keyboard.CODE_DUMMY); R.styleable.Keyboard_Key_altCode, Keyboard.CODE_UNSPECIFIED);
mHashCode = hashCode(this); mHashCode = hashCode(this);
keyAttr.recycle(); keyAttr.recycle();
@ -508,7 +508,7 @@ public class Key {
* @param y the y-coordinate of the point * @param y the y-coordinate of the point
* @return whether or not the point falls on the key. If the key is attached to an edge, it * @return whether or not the point falls on the key. If the key is attached to an edge, it
* will assume that all points between the key and the edge are considered to be on the key. * will assume that all points between the key and the edge are considered to be on the key.
* @see #markAsLeftEdge(KeyboardParams) etc. * @see #markAsLeftEdge(Keyboard.Params) etc.
*/ */
public boolean isOnKey(int x, int y) { public boolean isOnKey(int x, int y) {
return mHitBox.contains(x, y); return mHitBox.contains(x, y);
@ -615,7 +615,7 @@ public class Key {
* This constructor is being used only for divider in more keys keyboard. * This constructor is being used only for divider in more keys keyboard.
*/ */
public Spacer(Keyboard.Params params, Drawable icon, int x, int y, int width, int height) { public Spacer(Keyboard.Params params, Drawable icon, int x, int y, int width, int height) {
super(params, null, null, icon, Keyboard.CODE_DUMMY, null, x, y, width, height); super(params, null, null, icon, Keyboard.CODE_UNSPECIFIED, null, x, y, width, height);
} }
@Override @Override

View File

@ -86,19 +86,20 @@ public class Keyboard {
public static final int CODE_CLOSING_ANGLE_BRACKET = '>'; public static final int CODE_CLOSING_ANGLE_BRACKET = '>';
public static final int CODE_DIGIT0 = '0'; public static final int CODE_DIGIT0 = '0';
public static final int CODE_PLUS = '+'; public static final int CODE_PLUS = '+';
private static final int MINIMUM_LETTER_CODE = CODE_TAB;
/** Special keys code. Must be non-positive. /** Special keys code. Must be negative.
* These should be aligned with values/keycodes.xml * These should be aligned with values/keycodes.xml
*/ */
public static final int CODE_DUMMY = 0;
public static final int CODE_SHIFT = -1; public static final int CODE_SHIFT = -1;
public static final int CODE_SWITCH_ALPHA_SYMBOL = -2; public static final int CODE_SWITCH_ALPHA_SYMBOL = -2;
public static final int CODE_CAPSLOCK = -3; public static final int CODE_CAPSLOCK = -3;
public static final int CODE_OUTPUT_TEXT = -4;
public static final int CODE_DELETE = -5; public static final int CODE_DELETE = -5;
public static final int CODE_SETTINGS = -6; public static final int CODE_SETTINGS = -6;
public static final int CODE_SHORTCUT = -7; public static final int CODE_SHORTCUT = -7;
// Code value representing the code is not specified. // Code value representing the code is not specified.
public static final int CODE_UNSPECIFIED = -99; public static final int CODE_UNSPECIFIED = -9;
public final KeyboardId mId; public final KeyboardId mId;
public final int mThemeId; public final int mThemeId;
@ -167,7 +168,7 @@ public class Keyboard {
} }
public Key getKey(int code) { public Key getKey(int code) {
if (code == CODE_DUMMY) { if (code == CODE_UNSPECIFIED) {
return null; return null;
} }
final Integer keyCode = code; final Integer keyCode = code;
@ -253,7 +254,7 @@ public class Keyboard {
} }
public static boolean isLetterCode(int code) { public static boolean isLetterCode(int code) {
return code > CODE_DUMMY; return code >= MINIMUM_LETTER_CODE;
} }
public static class Params { public static class Params {
@ -428,9 +429,9 @@ public class Keyboard {
case CODE_SHIFT: return "shift"; case CODE_SHIFT: return "shift";
case CODE_SWITCH_ALPHA_SYMBOL: return "symbol"; case CODE_SWITCH_ALPHA_SYMBOL: return "symbol";
case CODE_CAPSLOCK: return "capslock"; case CODE_CAPSLOCK: return "capslock";
case CODE_OUTPUT_TEXT: return "text";
case CODE_DELETE: return "delete"; case CODE_DELETE: return "delete";
case CODE_SHORTCUT: return "shortcut"; case CODE_SHORTCUT: return "shortcut";
case CODE_DUMMY: return "dummy";
case CODE_UNSPECIFIED: return "unspec"; case CODE_UNSPECIFIED: return "unspec";
default: default:
if (code < 0) Log.w(TAG, "Unknow negative key code=" + code); if (code < 0) Log.w(TAG, "Unknow negative key code=" + code);

View File

@ -262,10 +262,8 @@ public class PointerTracker {
final boolean ignoreModifierKey = mIgnoreModifierKey && key.isModifier(); final boolean ignoreModifierKey = mIgnoreModifierKey && key.isModifier();
final boolean alterCode = key.altCodeWhileTyping() && mTimerProxy.isTyping(); final boolean alterCode = key.altCodeWhileTyping() && mTimerProxy.isTyping();
final int code = alterCode ? key.mAltCode : primaryCode; final int code = alterCode ? key.mAltCode : primaryCode;
// If code is CODE_DUMMY here, this key will be ignored or generate text.
final CharSequence text = (code != Keyboard.CODE_DUMMY) ? null : key.mOutputText;
if (DEBUG_LISTENER) { if (DEBUG_LISTENER) {
Log.d(TAG, "onCodeInput: " + Keyboard.printableCode(code) + " text=" + text Log.d(TAG, "onCodeInput: " + Keyboard.printableCode(code) + " text=" + key.mOutputText
+ " codes="+ KeyDetector.printableCodes(keyCodes) + " x=" + x + " y=" + y + " codes="+ KeyDetector.printableCodes(keyCodes) + " x=" + x + " y=" + y
+ " ignoreModifier=" + ignoreModifierKey + " alterCode=" + alterCode + " ignoreModifier=" + ignoreModifierKey + " alterCode=" + alterCode
+ " enabled=" + key.isEnabled()); + " enabled=" + key.isEnabled());
@ -274,10 +272,10 @@ public class PointerTracker {
return; return;
} }
if (key.isEnabled()) { if (key.isEnabled()) {
if (code != Keyboard.CODE_DUMMY) { if (code == Keyboard.CODE_OUTPUT_TEXT) {
mListener.onTextInput(key.mOutputText);
} else if (code != Keyboard.CODE_UNSPECIFIED) {
mListener.onCodeInput(code, keyCodes, x, y); mListener.onCodeInput(code, keyCodes, x, y);
} else if (text != null) {
mListener.onTextInput(text);
} }
if (!key.altCodeWhileTyping() && !key.isModifier()) { if (!key.altCodeWhileTyping() && !key.isModifier()) {
mTimerProxy.startKeyTypedTimer(sIgnoreSpecialKeyTimeout); mTimerProxy.startKeyTypedTimer(sIgnoreSpecialKeyTimeout);

View File

@ -434,7 +434,8 @@ public class KeyboardState {
} }
break; break;
case SWITCH_STATE_SYMBOL_BEGIN: case SWITCH_STATE_SYMBOL_BEGIN:
if (!isSpaceCharacter(code) && code >= 0) { if (!isSpaceCharacter(code) && (Keyboard.isLetterCode(code)
|| code == Keyboard.CODE_OUTPUT_TEXT)) {
mSwitchState = SWITCH_STATE_SYMBOL; mSwitchState = SWITCH_STATE_SYMBOL;
} }
// Snap back to alpha keyboard mode immediately if user types a quote character. // Snap back to alpha keyboard mode immediately if user types a quote character.

View File

@ -148,12 +148,12 @@ public class MoreKeySpecParser {
return code; return code;
} }
if (indexOfLabelEnd(moreKeySpec, 0) > 0) if (indexOfLabelEnd(moreKeySpec, 0) > 0)
return Keyboard.CODE_DUMMY; return Keyboard.CODE_UNSPECIFIED;
final String label = getLabel(moreKeySpec); final String label = getLabel(moreKeySpec);
// Code is automatically generated for one letter label. // Code is automatically generated for one letter label.
if (label != null && label.length() == 1) if (label != null && label.length() == 1)
return label.charAt(0); return label.charAt(0);
return Keyboard.CODE_DUMMY; return Keyboard.CODE_UNSPECIFIED;
} }
public static int getIconId(String moreKeySpec) { public static int getIconId(String moreKeySpec) {

View File

@ -1305,7 +1305,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
ic.commitText(text, 1); ic.commitText(text, 1);
ic.endBatchEdit(); ic.endBatchEdit();
mKeyboardSwitcher.updateShiftState(); mKeyboardSwitcher.updateShiftState();
mKeyboardSwitcher.onCodeInput(Keyboard.CODE_DUMMY); mKeyboardSwitcher.onCodeInput(Keyboard.CODE_OUTPUT_TEXT);
mSpaceState = SPACE_STATE_NONE; mSpaceState = SPACE_STATE_NONE;
mEnteredText = text; mEnteredText = text;
mWordComposer.reset(); mWordComposer.reset();

View File

@ -89,78 +89,78 @@ public class MoreKeySpecParserTests extends AndroidTestCase {
assertParser("Single escaped at", "\\@", assertParser("Single escaped at", "\\@",
"@", null, ICON_UNDEFINED, '@'); "@", null, ICON_UNDEFINED, '@');
assertParser("Single letter with outputText", "a|abc", assertParser("Single letter with outputText", "a|abc",
"a", "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a", "abc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Single letter with escaped outputText", "a|a\\|c", assertParser("Single letter with escaped outputText", "a|a\\|c",
"a", "a|c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a", "a|c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Single letter with comma outputText", "a|a,b", assertParser("Single letter with comma outputText", "a|a,b",
"a", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a", "a,b", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Single letter with escaped comma outputText", "a|a\\,b", assertParser("Single letter with escaped comma outputText", "a|a\\,b",
"a", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a", "a,b", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Single letter with outputText starts with at", "a|@bc", assertParser("Single letter with outputText starts with at", "a|@bc",
"a", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a", "@bc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Single letter with outputText contains at", "a|a@c", assertParser("Single letter with outputText contains at", "a|a@c",
"a", "a@c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a", "a@c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Single letter with escaped at outputText", "a|\\@bc", assertParser("Single letter with escaped at outputText", "a|\\@bc",
"a", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a", "@bc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Single escaped escape with outputText", "\\\\|\\\\", assertParser("Single escaped escape with outputText", "\\\\|\\\\",
"\\", "\\", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "\\", "\\", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Single escaped bar with outputText", "\\||\\|", assertParser("Single escaped bar with outputText", "\\||\\|",
"|", "|", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "|", "|", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Single letter with code", "a|" + CODE_SETTINGS, assertParser("Single letter with code", "a|" + CODE_SETTINGS,
"a", null, ICON_UNDEFINED, mCodeSettings); "a", null, ICON_UNDEFINED, mCodeSettings);
} }
public void testLabel() { public void testLabel() {
assertParser("Simple label", "abc", assertParser("Simple label", "abc",
"abc", "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "abc", "abc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with escaped bar", "a\\|c", assertParser("Label with escaped bar", "a\\|c",
"a|c", "a|c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a|c", "a|c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with escaped escape", "a\\\\c", assertParser("Label with escaped escape", "a\\\\c",
"a\\c", "a\\c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a\\c", "a\\c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with comma", "a,c", assertParser("Label with comma", "a,c",
"a,c", "a,c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a,c", "a,c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with escaped comma", "a\\,c", assertParser("Label with escaped comma", "a\\,c",
"a,c", "a,c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a,c", "a,c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label starts with at", "@bc", assertParser("Label starts with at", "@bc",
"@bc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "@bc", "@bc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label contains at", "a@c", assertParser("Label contains at", "a@c",
"a@c", "a@c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a@c", "a@c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with escaped at", "\\@bc", assertParser("Label with escaped at", "\\@bc",
"@bc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "@bc", "@bc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with escaped letter", "\\abc", assertParser("Label with escaped letter", "\\abc",
"abc", "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "abc", "abc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with outputText", "abc|def", assertParser("Label with outputText", "abc|def",
"abc", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "abc", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with comma and outputText", "a,c|def", assertParser("Label with comma and outputText", "a,c|def",
"a,c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a,c", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Escaped comma label with outputText", "a\\,c|def", assertParser("Escaped comma label with outputText", "a\\,c|def",
"a,c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a,c", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Escaped label with outputText", "a\\|c|def", assertParser("Escaped label with outputText", "a\\|c|def",
"a|c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a|c", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with escaped bar outputText", "abc|d\\|f", assertParser("Label with escaped bar outputText", "abc|d\\|f",
"abc", "d|f", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "abc", "d|f", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Escaped escape label with outputText", "a\\\\|def", assertParser("Escaped escape label with outputText", "a\\\\|def",
"a\\", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a\\", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label starts with at and outputText", "@bc|def", assertParser("Label starts with at and outputText", "@bc|def",
"@bc", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "@bc", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label contains at label and outputText", "a@c|def", assertParser("Label contains at label and outputText", "a@c|def",
"a@c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a@c", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Escaped at label with outputText", "\\@bc|def", assertParser("Escaped at label with outputText", "\\@bc|def",
"@bc", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "@bc", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with comma outputText", "abc|a,b", assertParser("Label with comma outputText", "abc|a,b",
"abc", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "abc", "a,b", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with escaped comma outputText", "abc|a\\,b", assertParser("Label with escaped comma outputText", "abc|a\\,b",
"abc", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "abc", "a,b", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with outputText starts with at", "abc|@bc", assertParser("Label with outputText starts with at", "abc|@bc",
"abc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "abc", "@bc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with outputText contains at", "abc|a@c", assertParser("Label with outputText contains at", "abc|a@c",
"abc", "a@c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "abc", "a@c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with escaped at outputText", "abc|\\@bc", assertParser("Label with escaped at outputText", "abc|\\@bc",
"abc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "abc", "@bc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with escaped bar outputText", "abc|d\\|f", assertParser("Label with escaped bar outputText", "abc|d\\|f",
"abc", "d|f", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "abc", "d|f", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Escaped bar label with escaped bar outputText", "a\\|c|d\\|f", assertParser("Escaped bar label with escaped bar outputText", "a\\|c|d\\|f",
"a|c", "d|f", ICON_UNDEFINED, Keyboard.CODE_DUMMY); "a|c", "d|f", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParser("Label with code", "abc|" + CODE_SETTINGS, assertParser("Label with code", "abc|" + CODE_SETTINGS,
"abc", null, ICON_UNDEFINED, mCodeSettings); "abc", null, ICON_UNDEFINED, mCodeSettings);
assertParser("Escaped label with code", "a\\|c|" + CODE_SETTINGS, assertParser("Escaped label with code", "a\\|c|" + CODE_SETTINGS,
@ -169,13 +169,13 @@ public class MoreKeySpecParserTests extends AndroidTestCase {
public void testIconAndCode() { public void testIconAndCode() {
assertParser("Icon with outputText", ICON_SETTINGS + "|abc", assertParser("Icon with outputText", ICON_SETTINGS + "|abc",
null, "abc", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY); null, "abc", ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED);
assertParser("Icon with outputText starts with at", ICON_SETTINGS + "|@bc", assertParser("Icon with outputText starts with at", ICON_SETTINGS + "|@bc",
null, "@bc", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY); null, "@bc", ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED);
assertParser("Icon with outputText contains at", ICON_SETTINGS + "|a@c", assertParser("Icon with outputText contains at", ICON_SETTINGS + "|a@c",
null, "a@c", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY); null, "a@c", ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED);
assertParser("Icon with escaped at outputText", ICON_SETTINGS + "|\\@bc", assertParser("Icon with escaped at outputText", ICON_SETTINGS + "|\\@bc",
null, "@bc", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY); null, "@bc", ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED);
assertParser("Label starts with at and code", "@bc|" + CODE_SETTINGS, assertParser("Label starts with at and code", "@bc|" + CODE_SETTINGS,
"@bc", null, ICON_UNDEFINED, mCodeSettings); "@bc", null, ICON_UNDEFINED, mCodeSettings);
assertParser("Label contains at and code", "a@c|" + CODE_SETTINGS, assertParser("Label contains at and code", "a@c|" + CODE_SETTINGS,
@ -190,7 +190,7 @@ public class MoreKeySpecParserTests extends AndroidTestCase {
assertParserError("Empty spec", "", null, assertParserError("Empty spec", "", null,
null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParserError("Empty label with outputText", "|a", assertParserError("Empty label with outputText", "|a",
null, "a", ICON_UNDEFINED, Keyboard.CODE_DUMMY); null, "a", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParserError("Empty label with code", "|" + CODE_SETTINGS, assertParserError("Empty label with code", "|" + CODE_SETTINGS,
null, null, ICON_UNDEFINED, mCodeSettings); null, null, ICON_UNDEFINED, mCodeSettings);
assertParserError("Empty outputText with label", "a|", assertParserError("Empty outputText with label", "a|",
@ -200,9 +200,9 @@ public class MoreKeySpecParserTests extends AndroidTestCase {
assertParserError("Empty icon and code", "|", assertParserError("Empty icon and code", "|",
null, null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); null, null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParserError("Icon without code", ICON_SETTINGS, assertParserError("Icon without code", ICON_SETTINGS,
null, null, ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY); null, null, ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED);
assertParser("Non existing icon", ICON_NON_EXISTING + "|abc", assertParser("Non existing icon", ICON_NON_EXISTING + "|abc",
null, "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); null, "abc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParserError("Non existing code", "abc|" + CODE_NON_EXISTING, assertParserError("Non existing code", "abc|" + CODE_NON_EXISTING,
"abc", null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); "abc", null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParserError("Third bar at end", "a|b|", assertParserError("Third bar at end", "a|b|",