Fix voice key on phone device

This change,
- changes voice key code back to -102
- renames some key code names and method names
- adds mic_slash_holo to drawable-hdpi

Change-Id: I8be3a20921f472ece4298edad2d275f29a7e4955
main
Tadashi G. Takaoka 2010-12-06 12:12:27 +09:00
parent cfb24365f9
commit e18bd3e323
7 changed files with 21 additions and 20 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -19,13 +19,13 @@
--> -->
<resources> <resources>
<!-- These code should be aligned with Keyboard.CODE_*. -->
<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_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_delete">-5</integer> <integer name="key_delete">-5</integer>
<!-- Keycode for F1 (function) key. This one switches between language switch & comma/.com -->
<integer name="key_settings">-100</integer> <integer name="key_settings">-100</integer>
<integer name="key_voice">-102</integer> <integer name="key_voice">-102</integer>
</resources> </resources>

View File

@ -410,7 +410,7 @@
<string name="subtype_mode_sr_keyboard">Serbian Keyboard</string> <string name="subtype_mode_sr_keyboard">Serbian Keyboard</string>
<string name="subtype_mode_sv_keyboard">Swedish Keyboard</string> <string name="subtype_mode_sv_keyboard">Swedish Keyboard</string>
<string name="subtype_mode_cs_voice">Czech Voice</string> <string name="subtype_mode_cs_voice">Czech Voice</string>
<string name="subtype_mode_de_voice">German Voice</string> <string name="subtype_mode_de_voice">German Voice</string>
<string name="subtype_mode_en_AU_voice">English (Australia) Voice</string> <string name="subtype_mode_en_AU_voice">English (Australia) Voice</string>
<string name="subtype_mode_en_GB_voice">English (Great Britain) Voice</string> <string name="subtype_mode_en_GB_voice">English (Great Britain) Voice</string>

View File

@ -59,25 +59,26 @@ public class Keyboard {
public static final int EDGE_TOP = 0x04; public static final int EDGE_TOP = 0x04;
public static final int EDGE_BOTTOM = 0x08; public static final int EDGE_BOTTOM = 0x08;
/** Some common keys code. These should be aligned with values/keycodes.xml */
public static final int CODE_ENTER = '\n'; public static final int CODE_ENTER = '\n';
public static final int CODE_TAB = '\t'; public static final int CODE_TAB = '\t';
public static final int CODE_SPACE = ' '; public static final int CODE_SPACE = ' ';
public static final int CODE_PERIOD = '.'; public static final int CODE_PERIOD = '.';
/** Special keys code. These should be aligned with values/keycodes.xml */
public static final int CODE_SHIFT = -1; public static final int CODE_SHIFT = -1;
public static final int CODE_MODE_CHANGE = -2; public static final int CODE_SWITCH_ALPHA_SYMBOL = -2;
public static final int CODE_CANCEL = -3; public static final int CODE_CANCEL = -3;
public static final int CODE_DONE = -4; public static final int CODE_DONE = -4;
public static final int CODE_DELETE = -5; public static final int CODE_DELETE = -5;
public static final int CODE_ALT = -6; public static final int CODE_ALT = -6;
public static final int CODE_SETTINGS = -100;
public static final int CODE_OPTIONS = -100; public static final int CODE_SETTINGS_LONGPRESS = -101;
public static final int CODE_OPTIONS_LONGPRESS = -101; // TODO: remove this once LatinIME stops referring to this.
public static final int CODE_VOICE = -102;
public static final int CODE_CAPSLOCK = -103; public static final int CODE_CAPSLOCK = -103;
public static final int CODE_NEXT_LANGUAGE = -104; public static final int CODE_NEXT_LANGUAGE = -104;
public static final int CODE_PREV_LANGUAGE = -105; public static final int CODE_PREV_LANGUAGE = -105;
// TODO: remove this once LatinIME stops referring to this.
public static final int CODE_VOICE = -109;
/** Horizontal gap default for all rows */ /** Horizontal gap default for all rows */
private int mDefaultHorizontalGap; private int mDefaultHorizontalGap;

View File

@ -88,8 +88,8 @@ public class LatinKeyboardView extends KeyboardView {
@Override @Override
protected boolean onLongPress(Key key) { protected boolean onLongPress(Key key) {
int primaryCode = key.mCodes[0]; int primaryCode = key.mCodes[0];
if (primaryCode == Keyboard.CODE_OPTIONS) { if (primaryCode == Keyboard.CODE_SETTINGS) {
return invokeOnKey(Keyboard.CODE_OPTIONS_LONGPRESS); return invokeOnKey(Keyboard.CODE_SETTINGS_LONGPRESS);
} else if (primaryCode == '0' && getLatinKeyboard().isPhoneKeyboard()) { } else if (primaryCode == '0' && getLatinKeyboard().isPhoneKeyboard()) {
// Long pressing on 0 in phone number keypad gives you a '+'. // Long pressing on 0 in phone number keypad gives you a '+'.
return invokeOnKey('+'); return invokeOnKey('+');

View File

@ -208,7 +208,7 @@ public class PointerTracker {
return false; return false;
int primaryCode = key.mCodes[0]; int primaryCode = key.mCodes[0];
return primaryCode == Keyboard.CODE_SHIFT return primaryCode == Keyboard.CODE_SHIFT
|| primaryCode == Keyboard.CODE_MODE_CHANGE; || primaryCode == Keyboard.CODE_SWITCH_ALPHA_SYMBOL;
} }
public boolean isModifier() { public boolean isModifier() {

View File

@ -1050,7 +1050,7 @@ public class LatinIME extends InputMethodService
} }
} }
private void onOptionKeyPressed() { private void onSettingsKeyPressed() {
if (!isShowingOptionDialog()) { if (!isShowingOptionDialog()) {
if (LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(mImm)) { if (LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(mImm)) {
showOptionsMenu(); showOptionsMenu();
@ -1060,7 +1060,7 @@ public class LatinIME extends InputMethodService
} }
} }
private void onOptionKeyLongPressed() { private void onSettingsKeyLongPressed() {
if (!isShowingOptionDialog()) { if (!isShowingOptionDialog()) {
if (LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(mImm)) { if (LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(mImm)) {
mImm.showInputMethodPicker(); mImm.showInputMethodPicker();
@ -1096,7 +1096,7 @@ public class LatinIME extends InputMethodService
if (!distinctMultiTouch) if (!distinctMultiTouch)
switcher.toggleShift(); switcher.toggleShift();
break; break;
case Keyboard.CODE_MODE_CHANGE: case Keyboard.CODE_SWITCH_ALPHA_SYMBOL:
// Symbol key is handled in onPress() when device has distinct multi-touch panel. // Symbol key is handled in onPress() when device has distinct multi-touch panel.
if (!distinctMultiTouch) if (!distinctMultiTouch)
switcher.changeKeyboardMode(); switcher.changeKeyboardMode();
@ -1106,11 +1106,11 @@ public class LatinIME extends InputMethodService
handleClose(); handleClose();
} }
break; break;
case Keyboard.CODE_OPTIONS: case Keyboard.CODE_SETTINGS:
onOptionKeyPressed(); onSettingsKeyPressed();
break; break;
case Keyboard.CODE_OPTIONS_LONGPRESS: case Keyboard.CODE_SETTINGS_LONGPRESS:
onOptionKeyLongPressed(); onSettingsKeyLongPressed();
break; break;
case Keyboard.CODE_NEXT_LANGUAGE: case Keyboard.CODE_NEXT_LANGUAGE:
toggleLanguage(false, true); toggleLanguage(false, true);
@ -1929,7 +1929,7 @@ public class LatinIME extends InputMethodService
final boolean distinctMultiTouch = switcher.hasDistinctMultitouch(); final boolean distinctMultiTouch = switcher.hasDistinctMultitouch();
if (distinctMultiTouch && primaryCode == Keyboard.CODE_SHIFT) { if (distinctMultiTouch && primaryCode == Keyboard.CODE_SHIFT) {
switcher.onPressShift(); switcher.onPressShift();
} else if (distinctMultiTouch && primaryCode == Keyboard.CODE_MODE_CHANGE) { } else if (distinctMultiTouch && primaryCode == Keyboard.CODE_SWITCH_ALPHA_SYMBOL) {
switcher.onPressSymbol(); switcher.onPressSymbol();
} else { } else {
switcher.onOtherKeyPressed(); switcher.onOtherKeyPressed();
@ -1944,7 +1944,7 @@ public class LatinIME extends InputMethodService
final boolean distinctMultiTouch = switcher.hasDistinctMultitouch(); final boolean distinctMultiTouch = switcher.hasDistinctMultitouch();
if (distinctMultiTouch && primaryCode == Keyboard.CODE_SHIFT) { if (distinctMultiTouch && primaryCode == Keyboard.CODE_SHIFT) {
switcher.onReleaseShift(); switcher.onReleaseShift();
} else if (distinctMultiTouch && primaryCode == Keyboard.CODE_MODE_CHANGE) { } else if (distinctMultiTouch && primaryCode == Keyboard.CODE_SWITCH_ALPHA_SYMBOL) {
switcher.onReleaseSymbol(); switcher.onReleaseSymbol();
} }
} }