Introduce noKeyPreview Key attribute

This change also removes hacks in LatinKeyboardView by utilizing
noKeyPreview attribute.

Bug: 5638595
Change-Id: Icd8a3af3b7849b941f8f5532e2b432e126a909e6
This commit is contained in:
Tadashi G. Takaoka 2011-11-18 13:47:48 -08:00
parent 18630d5fd6
commit 431ce93925
17 changed files with 90 additions and 77 deletions

View file

@ -221,6 +221,7 @@
<flag name="withIconLeft" value="0x1000" /> <flag name="withIconLeft" value="0x1000" />
<flag name="withIconRight" value="0x2000" /> <flag name="withIconRight" value="0x2000" />
<flag name="autoXScale" value="0x4000" /> <flag name="autoXScale" value="0x4000" />
<flag name="noKeyPreview" value="0x8000" />
</attr> </attr>
<!-- The icon to display on the key instead of the label. --> <!-- The icon to display on the key instead of the label. -->
<attr name="keyIcon" format="enum"> <attr name="keyIcon" format="enum">

View file

@ -44,24 +44,29 @@
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyIcon="iconShiftKey" latin:keyIcon="iconShiftKey"
latin:keyIconShifted="iconShiftedShiftKey" latin:keyIconShifted="iconShiftedShiftKey"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="sticky" /> latin:backgroundType="sticky" />
<key-style <key-style
latin:styleName="deleteKeyStyle" latin:styleName="deleteKeyStyle"
latin:code="@integer/key_delete" latin:code="@integer/key_delete"
latin:keyIcon="iconDeleteKey" latin:keyIcon="iconDeleteKey"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" latin:backgroundType="functional"
latin:isRepeatable="true" /> latin:isRepeatable="true" />
<key-style <key-style
latin:styleName="returnKeyStyle" latin:styleName="returnKeyStyle"
latin:code="@integer/key_return" latin:code="@integer/key_return"
latin:keyIcon="iconReturnKey" latin:keyIcon="iconReturnKey"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="spaceKeyStyle" latin:styleName="spaceKeyStyle"
latin:code="@integer/key_space" /> latin:code="@integer/key_space"
latin:keyLabelOption="noKeyPreview" />
<key-style <key-style
latin:styleName="nonSpecialBackgroundSpaceKeyStyle" latin:styleName="nonSpecialBackgroundSpaceKeyStyle"
latin:code="@integer/key_space" /> latin:code="@integer/key_space"
latin:keyLabelOption="noKeyPreview" />
<key-style <key-style
latin:styleName="smileyKeyStyle" latin:styleName="smileyKeyStyle"
latin:keyLabel=":-)" latin:keyLabel=":-)"
@ -73,11 +78,13 @@
latin:styleName="shortcutKeyStyle" latin:styleName="shortcutKeyStyle"
latin:code="@integer/key_shortcut" latin:code="@integer/key_shortcut"
latin:keyIcon="iconShortcutKey" latin:keyIcon="iconShortcutKey"
latin:keyLabelOption="noKeyPreview"
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:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="tabKeyStyle" latin:styleName="tabKeyStyle"
@ -89,21 +96,25 @@
latin:styleName="toSymbolKeyStyle" latin:styleName="toSymbolKeyStyle"
latin:code="@integer/key_switch_alpha_symbol" latin:code="@integer/key_switch_alpha_symbol"
latin:keyLabel="@string/label_to_symbol_key" latin:keyLabel="@string/label_to_symbol_key"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="toAlphaKeyStyle" latin:styleName="toAlphaKeyStyle"
latin:code="@integer/key_switch_alpha_symbol" latin:code="@integer/key_switch_alpha_symbol"
latin:keyLabel="@string/label_to_alpha_key" latin:keyLabel="@string/label_to_alpha_key"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="toMoreSymbolKeyStyle" latin:styleName="toMoreSymbolKeyStyle"
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyLabel="@string/label_to_more_symbol_for_tablet_key" latin:keyLabel="@string/label_to_more_symbol_for_tablet_key"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="backFromMoreSymbolKeyStyle" latin:styleName="backFromMoreSymbolKeyStyle"
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyLabel="@string/label_to_symbol_key" latin:keyLabel="@string/label_to_symbol_key"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="comKeyStyle" latin:styleName="comKeyStyle"

View file

@ -184,7 +184,7 @@
</Row> </Row>
<Row> <Row>
<Key <Key
latin:keyStyle="tabKeyStyle" latin:keyStyle="numTabKeyStyle"
latin:keyWidth="11.00%p" /> latin:keyWidth="11.00%p" />
<Key <Key
latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle"

View file

@ -100,7 +100,7 @@
</Row> </Row>
<Row> <Row>
<Key <Key
latin:keyStyle="tabKeyStyle" latin:keyStyle="numTabKeyStyle"
latin:keyWidth="11.00%p" /> latin:keyWidth="11.00%p" />
<Key <Key
latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle"

View file

@ -39,9 +39,7 @@
latin:keyStyle="numKeyStyle" latin:keyStyle="numKeyStyle"
latin:keyWidth="9.25%p" /> latin:keyWidth="9.25%p" />
<Key <Key
latin:code="44" latin:keyStyle="numPauseKeyStyle"
latin:keyLabel="@string/label_pause_key"
latin:keyLabelOption="followKeyHintLabelRatio|autoXScale"
latin:keyWidth="9.25%p" /> latin:keyWidth="9.25%p" />
<Key <Key
latin:keyStyle="num1KeyStyle" latin:keyStyle="num1KeyStyle"
@ -68,9 +66,7 @@
latin:keyStyle="numKeyStyle" latin:keyStyle="numKeyStyle"
latin:keyWidth="9.25%p" /> latin:keyWidth="9.25%p" />
<Key <Key
latin:code="59" latin:keyStyle="numWaitKeyStyle"
latin:keyLabel="@string/label_wait_key"
latin:keyLabelOption="followKeyHintLabelRatio|autoXScale"
latin:keyWidth="9.25%p" /> latin:keyWidth="9.25%p" />
<Key <Key
latin:keyStyle="num4KeyStyle" latin:keyStyle="num4KeyStyle"
@ -113,7 +109,7 @@
</Row> </Row>
<Row> <Row>
<Key <Key
latin:keyStyle="tabKeyStyle" latin:keyStyle="numTabKeyStyle"
latin:keyWidth="11.00%p" /> latin:keyWidth="11.00%p" />
<Key <Key
latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle"

View file

@ -26,24 +26,29 @@
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyIcon="iconShiftKey" latin:keyIcon="iconShiftKey"
latin:keyIconShifted="iconShiftedShiftKey" latin:keyIconShifted="iconShiftedShiftKey"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="sticky" /> latin:backgroundType="sticky" />
<key-style <key-style
latin:styleName="deleteKeyStyle" latin:styleName="deleteKeyStyle"
latin:code="@integer/key_delete" latin:code="@integer/key_delete"
latin:keyIcon="iconDeleteKey" latin:keyIcon="iconDeleteKey"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" latin:backgroundType="functional"
latin:isRepeatable="true" /> latin:isRepeatable="true" />
<key-style <key-style
latin:styleName="returnKeyStyle" latin:styleName="returnKeyStyle"
latin:code="@integer/key_return" latin:code="@integer/key_return"
latin:keyIcon="iconReturnKey" latin:keyIcon="iconReturnKey"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="spaceKeyStyle" latin:styleName="spaceKeyStyle"
latin:code="@integer/key_space" /> latin:code="@integer/key_space"
latin:keyLabelOption="noKeyPreview" />
<key-style <key-style
latin:styleName="nonSpecialBackgroundSpaceKeyStyle" latin:styleName="nonSpecialBackgroundSpaceKeyStyle"
latin:code="@integer/key_space" /> latin:code="@integer/key_space"
latin:keyLabelOption="noKeyPreview" />
<key-style <key-style
latin:styleName="smileyKeyStyle" latin:styleName="smileyKeyStyle"
latin:keyLabel=":-)" latin:keyLabel=":-)"
@ -55,11 +60,13 @@
latin:styleName="settingsKeyStyle" latin:styleName="settingsKeyStyle"
latin:code="@integer/key_settings" latin:code="@integer/key_settings"
latin:keyIcon="iconSettingsKey" latin:keyIcon="iconSettingsKey"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="shortcutKeyStyle" latin:styleName="shortcutKeyStyle"
latin:code="@integer/key_shortcut" latin:code="@integer/key_shortcut"
latin:keyIcon="iconShortcutKey" latin:keyIcon="iconShortcutKey"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="tabKeyStyle" latin:styleName="tabKeyStyle"
@ -71,25 +78,25 @@
latin:styleName="toSymbolKeyStyle" latin:styleName="toSymbolKeyStyle"
latin:code="@integer/key_switch_alpha_symbol" latin:code="@integer/key_switch_alpha_symbol"
latin:keyLabel="@string/label_to_symbol_key" latin:keyLabel="@string/label_to_symbol_key"
latin:keyLabelOption="fontNormal" latin:keyLabelOption="fontNormal|noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="toAlphaKeyStyle" latin:styleName="toAlphaKeyStyle"
latin:code="@integer/key_switch_alpha_symbol" latin:code="@integer/key_switch_alpha_symbol"
latin:keyLabel="@string/label_to_alpha_key" latin:keyLabel="@string/label_to_alpha_key"
latin:keyLabelOption="fontNormal" latin:keyLabelOption="fontNormal|noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="toMoreSymbolKeyStyle" latin:styleName="toMoreSymbolKeyStyle"
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyLabel="@string/label_to_more_symbol_for_tablet_key" latin:keyLabel="@string/label_to_more_symbol_for_tablet_key"
latin:keyLabelOption="fontNormal" latin:keyLabelOption="fontNormal|noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="backFromMoreSymbolKeyStyle" latin:styleName="backFromMoreSymbolKeyStyle"
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyLabel="@string/label_to_symbol_key" latin:keyLabel="@string/label_to_symbol_key"
latin:keyLabelOption="fontNormal" latin:keyLabelOption="fontNormal|noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="comKeyStyle" latin:styleName="comKeyStyle"

View file

@ -32,7 +32,7 @@
> >
<Row> <Row>
<Key <Key
latin:keyStyle="tabKeyStyle" latin:keyStyle="numTabKeyStyle"
latin:keyLabelOption="alignLeft" latin:keyLabelOption="alignLeft"
latin:keyWidth="11.172%p" /> latin:keyWidth="11.172%p" />
<Key <Key

View file

@ -28,7 +28,7 @@
latin:keyboardLayout="@xml/kbd_numkey_styles" /> latin:keyboardLayout="@xml/kbd_numkey_styles" />
<Row> <Row>
<Key <Key
latin:keyStyle="tabKeyStyle" latin:keyStyle="numTabKeyStyle"
latin:keyLabelOption="alignLeft" latin:keyLabelOption="alignLeft"
latin:keyWidth="11.172%p" /> latin:keyWidth="11.172%p" />
<Key <Key

View file

@ -28,7 +28,7 @@
latin:keyboardLayout="@xml/kbd_numkey_styles" /> latin:keyboardLayout="@xml/kbd_numkey_styles" />
<Row> <Row>
<Key <Key
latin:keyStyle="tabKeyStyle" latin:keyStyle="numTabKeyStyle"
latin:keyLabelOption="alignLeft" latin:keyLabelOption="alignLeft"
latin:keyWidth="11.172%p" /> latin:keyWidth="11.172%p" />
<Key <Key
@ -41,9 +41,7 @@
latin:keyStyle="numKeyStyle" latin:keyStyle="numKeyStyle"
latin:keyWidth="8.047%p" /> latin:keyWidth="8.047%p" />
<Key <Key
latin:code="44" latin:keyStyle="numPauseKeyStyle"
latin:keyLabel="@string/label_pause_key"
latin:keyLabelOption="followKeyHintLabelRatio|autoXScale"
latin:keyWidth="8.047%p" /> latin:keyWidth="8.047%p" />
<Key <Key
latin:keyStyle="num1KeyStyle" latin:keyStyle="num1KeyStyle"
@ -71,9 +69,7 @@
latin:keyStyle="numKeyStyle" latin:keyStyle="numKeyStyle"
latin:keyWidth="8.047%p" /> latin:keyWidth="8.047%p" />
<Key <Key
latin:code="59" latin:keyStyle="numWaitKeyStyle"
latin:keyLabel="@string/label_wait_key"
latin:keyLabelOption="followKeyHintLabelRatio|autoXScale"
latin:keyWidth="8.047%p" /> latin:keyWidth="8.047%p" />
<Key <Key
latin:keyStyle="num4KeyStyle" latin:keyStyle="num4KeyStyle"

View file

@ -67,11 +67,13 @@
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyIcon="iconShiftKey" latin:keyIcon="iconShiftKey"
latin:keyIconShifted="iconShiftedShiftKey" latin:keyIconShifted="iconShiftedShiftKey"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="sticky" /> latin:backgroundType="sticky" />
<key-style <key-style
latin:styleName="deleteKeyStyle" latin:styleName="deleteKeyStyle"
latin:code="@integer/key_delete" latin:code="@integer/key_delete"
latin:keyIcon="iconDeleteKey" latin:keyIcon="iconDeleteKey"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" latin:backgroundType="functional"
latin:isRepeatable="true" /> latin:isRepeatable="true" />
<!-- Return key style --> <!-- Return key style -->
@ -96,7 +98,7 @@
latin:styleName="returnKeyStyle" latin:styleName="returnKeyStyle"
latin:code="@integer/key_return" latin:code="@integer/key_return"
latin:keyLabel="@string/label_go_key" latin:keyLabel="@string/label_go_key"
latin:keyLabelOption="autoXScale" latin:keyLabelOption="autoXScale|noKeyPreview"
latin:backgroundType="action" /> latin:backgroundType="action" />
</case> </case>
<case <case
@ -106,7 +108,7 @@
latin:styleName="returnKeyStyle" latin:styleName="returnKeyStyle"
latin:code="@integer/key_return" latin:code="@integer/key_return"
latin:keyLabel="@string/label_next_key" latin:keyLabel="@string/label_next_key"
latin:keyLabelOption="autoXScale" latin:keyLabelOption="autoXScale|noKeyPreview"
latin:backgroundType="action" /> latin:backgroundType="action" />
</case> </case>
<case <case
@ -116,7 +118,7 @@
latin:styleName="returnKeyStyle" latin:styleName="returnKeyStyle"
latin:code="@integer/key_return" latin:code="@integer/key_return"
latin:keyLabel="@string/label_done_key" latin:keyLabel="@string/label_done_key"
latin:keyLabelOption="autoXScale" latin:keyLabelOption="autoXScale|noKeyPreview"
latin:backgroundType="action" /> latin:backgroundType="action" />
</case> </case>
<case <case
@ -126,7 +128,7 @@
latin:styleName="returnKeyStyle" latin:styleName="returnKeyStyle"
latin:code="@integer/key_return" latin:code="@integer/key_return"
latin:keyLabel="@string/label_send_key" latin:keyLabel="@string/label_send_key"
latin:keyLabelOption="autoXScale" latin:keyLabelOption="autoXScale|noKeyPreview"
latin:backgroundType="action" /> latin:backgroundType="action" />
</case> </case>
<case <case
@ -136,6 +138,7 @@
latin:styleName="returnKeyStyle" latin:styleName="returnKeyStyle"
latin:code="@integer/key_return" latin:code="@integer/key_return"
latin:keyIcon="iconSearchKey" latin:keyIcon="iconSearchKey"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="action" /> latin:backgroundType="action" />
</case> </case>
<default> <default>
@ -143,22 +146,26 @@
latin:styleName="returnKeyStyle" latin:styleName="returnKeyStyle"
latin:code="@integer/key_return" latin:code="@integer/key_return"
latin:keyIcon="iconReturnKey" latin:keyIcon="iconReturnKey"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
</default> </default>
</switch> </switch>
<key-style <key-style
latin:styleName="spaceKeyStyle" latin:styleName="spaceKeyStyle"
latin:code="@integer/key_space" latin:code="@integer/key_space"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="shortcutKeyStyle" latin:styleName="shortcutKeyStyle"
latin:code="@integer/key_shortcut" latin:code="@integer/key_shortcut"
latin:keyIcon="iconShortcutKey" latin:keyIcon="iconShortcutKey"
latin:keyLabelOption="noKeyPreview"
latin:parentStyle="f1PopupStyle" /> latin:parentStyle="f1PopupStyle" />
<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:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="tabKeyStyle" latin:styleName="tabKeyStyle"
@ -186,7 +193,7 @@
latin:code="@integer/key_switch_alpha_symbol" latin:code="@integer/key_switch_alpha_symbol"
latin:keyIcon="iconShortcutForLabel" latin:keyIcon="iconShortcutForLabel"
latin:keyLabel="@string/label_to_symbol_with_microphone_key" latin:keyLabel="@string/label_to_symbol_with_microphone_key"
latin:keyLabelOption="withIconRight" latin:keyLabelOption="withIconRight|noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
</case> </case>
<default> <default>
@ -194,6 +201,7 @@
latin:styleName="toSymbolKeyStyle" latin:styleName="toSymbolKeyStyle"
latin:code="@integer/key_switch_alpha_symbol" latin:code="@integer/key_switch_alpha_symbol"
latin:keyLabel="@string/label_to_symbol_key" latin:keyLabel="@string/label_to_symbol_key"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
</default> </default>
</switch> </switch>
@ -201,16 +209,19 @@
latin:styleName="toAlphaKeyStyle" latin:styleName="toAlphaKeyStyle"
latin:code="@integer/key_switch_alpha_symbol" latin:code="@integer/key_switch_alpha_symbol"
latin:keyLabel="@string/label_to_alpha_key" latin:keyLabel="@string/label_to_alpha_key"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="toMoreSymbolKeyStyle" latin:styleName="toMoreSymbolKeyStyle"
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyLabel="@string/label_to_more_symbol_key" latin:keyLabel="@string/label_to_more_symbol_key"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="backFromMoreSymbolKeyStyle" latin:styleName="backFromMoreSymbolKeyStyle"
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyLabel="@string/label_to_symbol_key" latin:keyLabel="@string/label_to_symbol_key"
latin:keyLabelOption="noKeyPreview"
latin:backgroundType="functional" /> latin:backgroundType="functional" />
<key-style <key-style
latin:styleName="punctuationKeyStyle" latin:styleName="punctuationKeyStyle"

View file

@ -21,16 +21,22 @@
<merge <merge
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
> >
<key-style
latin:styleName="numKeyBaseStyle"
latin:keyLabelOption="noKeyPreview" />
<key-style <key-style
latin:styleName="numKeyStyle" latin:styleName="numKeyStyle"
latin:keyLabelOption="largeLetter|followKeyLetterRatio" /> latin:keyLabelOption="largeLetter|followKeyLetterRatio"
latin:parentStyle="numKeyBaseStyle" />
<key-style <key-style
latin:styleName="numModeKeyStyle" latin:styleName="numModeKeyStyle"
latin:keyLabelOption="fontNormal|followKeyLetterRatio" /> latin:keyLabelOption="fontNormal|followKeyLetterRatio"
latin:parentStyle="numKeyBaseStyle" />
<key-style <key-style
latin:styleName="numFunctionalKeyStyle" latin:styleName="numFunctionalKeyStyle"
latin:keyLabelOption="largeLetter|followKeyLetterRatio" latin:keyLabelOption="largeLetter|followKeyLetterRatio"
latin:backgroundType="functional" /> latin:backgroundType="functional"
latin:parentStyle="numKeyBaseStyle" />
<key-style <key-style
latin:styleName="numberKeyStyle" latin:styleName="numberKeyStyle"
latin:keyLabelOption="alignLeftOfCenter|hasHintLabel" latin:keyLabelOption="alignLeftOfCenter|hasHintLabel"
@ -99,8 +105,25 @@
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyLabel="@string/label_to_phone_numeric_key" latin:keyLabel="@string/label_to_phone_numeric_key"
latin:parentStyle="numModeKeyStyle" /> latin:parentStyle="numModeKeyStyle" />
<key-style
latin:styleName="numPauseKeyStyle"
latin:code="44"
latin:keyLabel="@string/label_pause_key"
latin:keyLabelOption="followKeyHintLabelRatio|autoXScale"
latin:parentStyle="numKeyBaseStyle" />
<key-style
latin:styleName="numWaitKeyStyle"
latin:code="59"
latin:keyLabel="@string/label_wait_key"
latin:keyLabelOption="followKeyHintLabelRatio|autoXScale"
latin:parentStyle="numKeyBaseStyle" />
<key-style
latin:styleName="numTabKeyStyle"
latin:keyLabelOption="noKeyPreview"
latin:parentStyle="tabKeyStyle" />
<key-style <key-style
latin:styleName="numSpaceKeyStyle" latin:styleName="numSpaceKeyStyle"
latin:code="@integer/key_space" latin:code="@integer/key_space"
latin:keyIcon="iconSpaceKey" /> latin:keyIcon="iconSpaceKey"
latin:parentStyle="numKeyBaseStyle" />
</merge> </merge>

View file

@ -42,13 +42,12 @@
</Row> </Row>
<Row> <Row>
<Key <Key
latin:keyLabel="N" /> latin:keyLabel="N"
latin:keyStyle="numKeyBaseStyle" />
<!-- Pause is a comma. Check PhoneNumberUtils.java to see if this <!-- Pause is a comma. Check PhoneNumberUtils.java to see if this
has changed. --> has changed. -->
<Key <Key
latin:code="44" latin:keyStyle="numPauseKeyStyle" />
latin:keyLabel="@string/label_pause_key"
latin:keyLabelOption="followKeyHintLabelRatio|autoXScale" />
<Key <Key
latin:keyLabel="," latin:keyLabel=","
latin:keyStyle="numKeyStyle" /> latin:keyStyle="numKeyStyle" />
@ -62,9 +61,7 @@
latin:keyStyle="numStarKeyStyle" /> latin:keyStyle="numStarKeyStyle" />
<!-- Wait is a semicolon. --> <!-- Wait is a semicolon. -->
<Key <Key
latin:code="59" latin:keyStyle="numWaitKeyStyle" />
latin:keyLabel="@string/label_wait_key"
latin:keyLabelOption="followKeyHintLabelRatio|autoXScale" />
<Key <Key
latin:keyLabel="#" latin:keyLabel="#"
latin:keyStyle="numKeyStyle" /> latin:keyStyle="numKeyStyle" />

View file

@ -67,6 +67,7 @@ public class Key {
private static final int LABEL_OPTION_WITH_ICON_LEFT = 0x1000; private static final int LABEL_OPTION_WITH_ICON_LEFT = 0x1000;
private static final int LABEL_OPTION_WITH_ICON_RIGHT = 0x2000; private static final int LABEL_OPTION_WITH_ICON_RIGHT = 0x2000;
private static final int LABEL_OPTION_AUTO_X_SCALE = 0x4000; private static final int LABEL_OPTION_AUTO_X_SCALE = 0x4000;
private static final int LABEL_OPTION_NO_KEY_PREVIEW = 0x8000;
/** Icon to display instead of a label. Icon takes precedence over a label */ /** Icon to display instead of a label. Icon takes precedence over a label */
private Drawable mIcon; private Drawable mIcon;
@ -386,6 +387,10 @@ public class Key {
return (mLabelOption & LABEL_OPTION_AUTO_X_SCALE) != 0; return (mLabelOption & LABEL_OPTION_AUTO_X_SCALE) != 0;
} }
public boolean noKeyPreview() {
return (mLabelOption & LABEL_OPTION_NO_KEY_PREVIEW) != 0;
}
public Drawable getIcon() { public Drawable getIcon() {
return mIcon; return mIcon;
} }

View file

@ -217,10 +217,6 @@ public class Keyboard {
return mId.isPhoneKeyboard(); return mId.isPhoneKeyboard();
} }
public boolean isNumberKeyboard() {
return mId.isNumberKeyboard();
}
public CharSequence adjustLabelCase(CharSequence label) { public CharSequence adjustLabelCase(CharSequence label) {
if (isShiftedOrShiftLocked() && !TextUtils.isEmpty(label) && label.length() < 3 if (isShiftedOrShiftLocked() && !TextUtils.isEmpty(label) && label.length() < 3
&& Character.isLowerCase(label.charAt(0))) { && Character.isLowerCase(label.charAt(0))) {

View file

@ -133,10 +133,6 @@ public class KeyboardId {
return mXmlId == R.xml.kbd_phone_shift; return mXmlId == R.xml.kbd_phone_shift;
} }
public boolean isNumberKeyboard() {
return mMode == MODE_NUMBER;
}
@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
return other instanceof KeyboardId && equals((KeyboardId) other); return other instanceof KeyboardId && equals((KeyboardId) other);

View file

@ -263,20 +263,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
return mKeyTimerHandler; return mKeyTimerHandler;
} }
@Override
public void setKeyPreviewPopupEnabled(boolean previewEnabled, int delay) {
final Keyboard keyboard = getKeyboard();
if (keyboard instanceof LatinKeyboard) {
final LatinKeyboard latinKeyboard = (LatinKeyboard)keyboard;
if (latinKeyboard.isPhoneKeyboard() || latinKeyboard.isNumberKeyboard()) {
// Phone and number keyboard never shows popup preview.
super.setKeyPreviewPopupEnabled(false, delay);
return;
}
}
super.setKeyPreviewPopupEnabled(previewEnabled, delay);
}
/** /**
* Attaches a keyboard to this view. The keyboard can be switched at any time and the * Attaches a keyboard to this view. The keyboard can be switched at any time and the
* view will re-layout itself to accommodate the keyboard. * view will re-layout itself to accommodate the keyboard.

View file

@ -343,7 +343,7 @@ public class PointerTracker {
private void setPressedKeyGraphics(int keyIndex) { private void setPressedKeyGraphics(int keyIndex) {
final Key key = getKey(keyIndex); final Key key = getKey(keyIndex);
if (key != null && key.isEnabled()) { if (key != null && key.isEnabled()) {
if (isKeyPreviewRequired(key)) { if (!key.noKeyPreview()) {
mDrawingProxy.showKeyPreview(keyIndex, this); mDrawingProxy.showKeyPreview(keyIndex, this);
} }
key.onPressed(); key.onPressed();
@ -351,18 +351,6 @@ public class PointerTracker {
} }
} }
// The modifier key, such as shift key, should not show its key preview.
private static boolean isKeyPreviewRequired(Key key) {
final int code = key.mCode;
// TODO: Stop hard-coding these key codes here, and add a new key attribute of a key.
if (code == Keyboard.CODE_SPACE || code == Keyboard.CODE_ENTER
|| code == Keyboard.CODE_DELETE || isModifierCode(code)
|| code == Keyboard.CODE_SETTINGS || code == Keyboard.CODE_SHORTCUT) {
return false;
}
return true;
}
public int getLastX() { public int getLastX() {
return mLastX; return mLastX;
} }