Rename and reorganize key code

Change-Id: I13d6fef7af1c4356a22b0e8aebc9e613b1693ece
main
Tadashi G. Takaoka 2011-04-21 19:43:20 +09:00
parent c9c3aa219e
commit d2c5fdda86
7 changed files with 20 additions and 22 deletions

View File

@ -26,8 +26,8 @@
<integer name="key_shift">-1</integer>
<integer name="key_switch_alpha_symbol">-2</integer>
<integer name="key_delete">-5</integer>
<integer name="key_settings">-100</integer>
<integer name="key_voice">-102</integer>
<integer name="key_settings">-6</integer>
<integer name="key_shortcut">-8</integer>
<!-- Array used for mapping key codes to description strings. -->
<array name="key_descriptions">
@ -45,7 +45,7 @@
<item>@string/description_delete_key</item>
<item>@integer/key_settings</item>
<item>@string/description_settings_key</item>
<item>@integer/key_voice</item>
<item>@integer/key_shortcut</item>
<item>@string/description_voice_key</item>
</array>
</resources>

View File

@ -73,7 +73,7 @@
latin:parentStyle="functionalKeyStyle" />
<key-style
latin:styleName="micKeyStyle"
latin:code="@integer/key_voice"
latin:code="@integer/key_shortcut"
latin:keyIcon="@drawable/sym_keyboard_voice_holo"
latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
latin:parentStyle="functionalKeyStyle" />
@ -127,7 +127,7 @@
latin:parentStyle="functionalKeyStyle" />
<key-style
latin:styleName="micKeyStyle"
latin:code="@integer/key_voice"
latin:code="@integer/key_shortcut"
latin:keyIcon="@drawable/sym_bkeyboard_mic"
latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
latin:parentStyle="functionalKeyStyle" />

View File

@ -118,7 +118,7 @@
latin:parentStyle="functionalKeyStyle" />
<key-style
latin:styleName="micKeyStyle"
latin:code="@integer/key_voice"
latin:code="@integer/key_shortcut"
latin:keyIcon="@drawable/sym_keyboard_mic"
latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
latin:parentStyle="settingsPopupStyle" />
@ -191,7 +191,7 @@
latin:parentStyle="functionalKeyStyle" />
<key-style
latin:styleName="micKeyStyle"
latin:code="@integer/key_voice"
latin:code="@integer/key_shortcut"
latin:keyIcon="@drawable/sym_bkeyboard_mic"
latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
latin:parentStyle="settingsPopupStyle" />

View File

@ -68,19 +68,14 @@ public class Keyboard {
public static final int CODE_DUMMY = 0;
public static final int CODE_SHIFT = -1;
public static final int CODE_SWITCH_ALPHA_SYMBOL = -2;
public static final int CODE_CANCEL = -3;
public static final int CODE_DONE = -4;
public static final int CODE_CAPSLOCK = -3;
public static final int CODE_CANCEL = -4;
public static final int CODE_DELETE = -5;
public static final int CODE_ALT = -6;
public static final int CODE_SETTINGS = -6;
public static final int CODE_SETTINGS_LONGPRESS = -7;
public static final int CODE_SHORTCUT = -8;
// Code value representing the code is not specified.
public static final int CODE_UNSPECIFIED = -99;
public static final int CODE_SETTINGS = -100;
public static final int CODE_SETTINGS_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_NEXT_LANGUAGE = -104;
public static final int CODE_PREV_LANGUAGE = -105;
/** Horizontal gap default for all rows */
private int mDefaultHorizontalGap;

View File

@ -46,6 +46,9 @@ import java.util.Locale;
public class LatinKeyboard extends Keyboard {
private static final int SPACE_LED_LENGTH_PERCENT = 80;
public static final int CODE_NEXT_LANGUAGE = -100;
public static final int CODE_PREV_LANGUAGE = -101;
private final Context mContext;
private final SubtypeSwitcher mSubtypeSwitcher = SubtypeSwitcher.getInstance();
@ -102,7 +105,7 @@ public class LatinKeyboard extends Keyboard {
case CODE_SPACE:
spaceKeyIndex = index;
break;
case CODE_VOICE:
case CODE_SHORTCUT:
shortcutKeyIndex = index;
break;
}

View File

@ -236,7 +236,7 @@ public class LatinKeyboardView extends KeyboardView {
if (languageDirection != 0) {
getOnKeyboardActionListener().onCodeInput(
languageDirection == 1
? Keyboard.CODE_NEXT_LANGUAGE : Keyboard.CODE_PREV_LANGUAGE,
? LatinKeyboard.CODE_NEXT_LANGUAGE : LatinKeyboard.CODE_PREV_LANGUAGE,
null, mLastX, mLastY);
me.setAction(MotionEvent.ACTION_CANCEL);
keyboard.keyReleased();

View File

@ -1159,16 +1159,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
case Keyboard.CODE_SETTINGS_LONGPRESS:
onSettingsKeyLongPressed();
break;
case Keyboard.CODE_NEXT_LANGUAGE:
case LatinKeyboard.CODE_NEXT_LANGUAGE:
toggleLanguage(true);
break;
case Keyboard.CODE_PREV_LANGUAGE:
case LatinKeyboard.CODE_PREV_LANGUAGE:
toggleLanguage(false);
break;
case Keyboard.CODE_CAPSLOCK:
switcher.toggleCapsLock();
break;
case Keyboard.CODE_VOICE:
case Keyboard.CODE_SHORTCUT:
mSubtypeSwitcher.switchToShortcutIME();
break;
case Keyboard.CODE_TAB: