Disable long-press on shift and symbol keys
Long-press on shift and symbol keys will conflict with press-and-hold these keys and press normal key (a.k.a. multi touch support). Bug: 2910379 Change-Id: I27007b55a30a3699bf63fd8f64d58c4b23d97d9fmain
parent
830fd4af56
commit
cec1495071
|
@ -50,8 +50,6 @@
|
||||||
|
|
||||||
<Row android:rowEdgeFlags="bottom">
|
<Row android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyIcon="@drawable/sym_keyboard_numalt"
|
<Key android:codes="-2" android:keyIcon="@drawable/sym_keyboard_numalt"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:iconPreview="@drawable/sym_keyboard_feedback_numalt"/>
|
android:iconPreview="@drawable/sym_keyboard_feedback_numalt"/>
|
||||||
|
|
||||||
<Key android:codes="48" android:keyIcon="@drawable/sym_keyboard_num0"/>
|
<Key android:codes="48" android:keyIcon="@drawable/sym_keyboard_num0"/>
|
||||||
|
|
|
@ -50,8 +50,6 @@
|
||||||
|
|
||||||
<Row android:rowEdgeFlags="bottom">
|
<Row android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyIcon="@drawable/sym_bkeyboard_numalt"
|
<Key android:codes="-2" android:keyIcon="@drawable/sym_bkeyboard_numalt"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:iconPreview="@drawable/sym_keyboard_feedback_numalt"/>
|
android:iconPreview="@drawable/sym_keyboard_feedback_numalt"/>
|
||||||
|
|
||||||
<Key android:codes="48" android:keyIcon="@drawable/sym_bkeyboard_num0"/>
|
<Key android:codes="48" android:keyIcon="@drawable/sym_bkeyboard_num0"/>
|
||||||
|
|
|
@ -55,8 +55,6 @@
|
||||||
|
|
||||||
<Row android:rowEdgeFlags="bottom">
|
<Row android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_phone_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_phone_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyEdgeFlags="left"/>
|
android:keyEdgeFlags="left"/>
|
||||||
<Key android:keyLabel="+"/>
|
<Key android:keyLabel="+"/>
|
||||||
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
|
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
|
||||||
|
|
|
@ -55,8 +55,6 @@
|
||||||
|
|
||||||
<Row android:rowEdgeFlags="bottom">
|
<Row android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_phone_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_phone_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyEdgeFlags="left"/>
|
android:keyEdgeFlags="left"/>
|
||||||
<Key android:keyLabel="+"/>
|
<Key android:keyLabel="+"/>
|
||||||
<Key android:codes="32" android:keyIcon="@drawable/sym_bkeyboard_space"
|
<Key android:codes="32" android:keyIcon="@drawable/sym_bkeyboard_space"
|
||||||
|
|
|
@ -111,8 +111,6 @@
|
||||||
|
|
||||||
<Row android:keyboardMode="@+id/mode_normal" android:rowEdgeFlags="bottom">
|
<Row android:keyboardMode="@+id/mode_normal" android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
||||||
<Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_mic"
|
<Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_mic"
|
||||||
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
||||||
|
@ -129,8 +127,6 @@
|
||||||
|
|
||||||
<Row android:keyboardMode="@+id/mode_url" android:rowEdgeFlags="bottom">
|
<Row android:keyboardMode="@+id/mode_url" android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
||||||
<Key android:keyLabel="/" android:keyWidth="10%p"/>
|
<Key android:keyLabel="/" android:keyWidth="10%p"/>
|
||||||
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
|
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
|
||||||
|
@ -149,8 +145,6 @@
|
||||||
|
|
||||||
<Row android:keyboardMode="@+id/mode_email" android:rowEdgeFlags="bottom">
|
<Row android:keyboardMode="@+id/mode_email" android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
||||||
<Key android:keyLabel="\@"/>
|
<Key android:keyLabel="\@"/>
|
||||||
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
|
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
|
||||||
|
@ -168,8 +162,6 @@
|
||||||
|
|
||||||
<Row android:keyboardMode="@+id/mode_im" android:rowEdgeFlags="bottom">
|
<Row android:keyboardMode="@+id/mode_im" android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
||||||
<Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_mic"
|
<Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_mic"
|
||||||
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
||||||
|
@ -186,8 +178,6 @@
|
||||||
|
|
||||||
<Row android:keyboardMode="@+id/mode_webentry" android:rowEdgeFlags="bottom">
|
<Row android:keyboardMode="@+id/mode_webentry" android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
||||||
<Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_mic"
|
<Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_mic"
|
||||||
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
||||||
|
|
|
@ -111,8 +111,6 @@
|
||||||
|
|
||||||
<Row android:keyboardMode="@+id/mode_normal" android:rowEdgeFlags="bottom">
|
<Row android:keyboardMode="@+id/mode_normal" android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
||||||
<Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_bkeyboard_mic"
|
<Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_bkeyboard_mic"
|
||||||
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
||||||
|
@ -129,8 +127,6 @@
|
||||||
|
|
||||||
<Row android:keyboardMode="@+id/mode_url" android:rowEdgeFlags="bottom">
|
<Row android:keyboardMode="@+id/mode_url" android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
||||||
<Key android:keyLabel="/" android:keyWidth="10%p"/>
|
<Key android:keyLabel="/" android:keyWidth="10%p"/>
|
||||||
<Key android:codes="32" android:keyIcon="@drawable/sym_bkeyboard_space"
|
<Key android:codes="32" android:keyIcon="@drawable/sym_bkeyboard_space"
|
||||||
|
@ -149,8 +145,6 @@
|
||||||
|
|
||||||
<Row android:keyboardMode="@+id/mode_email" android:rowEdgeFlags="bottom">
|
<Row android:keyboardMode="@+id/mode_email" android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
||||||
<Key android:keyLabel="\@"/>
|
<Key android:keyLabel="\@"/>
|
||||||
<Key android:codes="32" android:keyIcon="@drawable/sym_bkeyboard_space"
|
<Key android:codes="32" android:keyIcon="@drawable/sym_bkeyboard_space"
|
||||||
|
@ -168,8 +162,6 @@
|
||||||
|
|
||||||
<Row android:keyboardMode="@+id/mode_im" android:rowEdgeFlags="bottom">
|
<Row android:keyboardMode="@+id/mode_im" android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
||||||
<Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_bkeyboard_mic"
|
<Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_bkeyboard_mic"
|
||||||
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
||||||
|
@ -186,8 +178,6 @@
|
||||||
|
|
||||||
<Row android:keyboardMode="@+id/mode_webentry" android:rowEdgeFlags="bottom">
|
<Row android:keyboardMode="@+id/mode_webentry" android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
||||||
<Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_bkeyboard_mic"
|
<Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_bkeyboard_mic"
|
||||||
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
||||||
|
|
|
@ -123,8 +123,6 @@
|
||||||
|
|
||||||
<Row android:rowEdgeFlags="bottom">
|
<Row android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_alpha_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_alpha_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
||||||
<Key android:codes="@integer/key_f1" android:keyWidth="10%p"/>
|
<Key android:codes="@integer/key_f1" android:keyWidth="10%p"/>
|
||||||
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
|
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
|
||||||
|
|
|
@ -123,8 +123,6 @@
|
||||||
|
|
||||||
<Row android:rowEdgeFlags="bottom">
|
<Row android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_alpha_key"
|
<Key android:codes="-2" android:keyLabel="@string/label_alpha_key"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
|
||||||
<Key android:codes="@integer/key_f1" android:keyWidth="10%p"/>
|
<Key android:codes="@integer/key_f1" android:keyWidth="10%p"/>
|
||||||
<Key android:codes="32" android:keyIcon="@drawable/sym_bkeyboard_space"
|
<Key android:codes="32" android:keyIcon="@drawable/sym_bkeyboard_space"
|
||||||
|
|
|
@ -90,8 +90,6 @@
|
||||||
|
|
||||||
<Row android:rowEdgeFlags="bottom">
|
<Row android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_alpha_key" android:keyWidth="20%p"
|
<Key android:codes="-2" android:keyLabel="@string/label_alpha_key" android:keyWidth="20%p"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyEdgeFlags="left"/>
|
android:keyEdgeFlags="left"/>
|
||||||
<Key android:keyLabel="„" android:keyWidth="10%p" />
|
<Key android:keyLabel="„" android:keyWidth="10%p" />
|
||||||
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
|
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
|
||||||
|
|
|
@ -90,8 +90,6 @@
|
||||||
|
|
||||||
<Row android:rowEdgeFlags="bottom">
|
<Row android:rowEdgeFlags="bottom">
|
||||||
<Key android:codes="-2" android:keyLabel="@string/label_alpha_key" android:keyWidth="20%p"
|
<Key android:codes="-2" android:keyLabel="@string/label_alpha_key" android:keyWidth="20%p"
|
||||||
android:popupKeyboard="@xml/kbd_popup_template"
|
|
||||||
android:popupCharacters="_"
|
|
||||||
android:keyEdgeFlags="left"/>
|
android:keyEdgeFlags="left"/>
|
||||||
<Key android:keyLabel="„" android:keyWidth="10%p" />
|
<Key android:keyLabel="„" android:keyWidth="10%p" />
|
||||||
<Key android:codes="32" android:keyIcon="@drawable/sym_bkeyboard_space"
|
<Key android:codes="32" android:keyIcon="@drawable/sym_bkeyboard_space"
|
||||||
|
|
|
@ -1103,9 +1103,6 @@ public class LatinIME extends InputMethodService
|
||||||
case LatinKeyboardView.KEYCODE_PREV_LANGUAGE:
|
case LatinKeyboardView.KEYCODE_PREV_LANGUAGE:
|
||||||
toggleLanguage(false, false);
|
toggleLanguage(false, false);
|
||||||
break;
|
break;
|
||||||
case LatinKeyboardView.KEYCODE_SHIFT_LONGPRESS:
|
|
||||||
handleCapsLock();
|
|
||||||
break;
|
|
||||||
case Keyboard.KEYCODE_MODE_CHANGE:
|
case Keyboard.KEYCODE_MODE_CHANGE:
|
||||||
changeKeyboardMode();
|
changeKeyboardMode();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -34,7 +34,6 @@ import android.widget.PopupWindow;
|
||||||
public class LatinKeyboardView extends LatinKeyboardBaseView {
|
public class LatinKeyboardView extends LatinKeyboardBaseView {
|
||||||
|
|
||||||
static final int KEYCODE_OPTIONS = -100;
|
static final int KEYCODE_OPTIONS = -100;
|
||||||
static final int KEYCODE_SHIFT_LONGPRESS = -101;
|
|
||||||
static final int KEYCODE_VOICE = -102;
|
static final int KEYCODE_VOICE = -102;
|
||||||
static final int KEYCODE_F1 = -103;
|
static final int KEYCODE_F1 = -103;
|
||||||
static final int KEYCODE_NEXT_LANGUAGE = -104;
|
static final int KEYCODE_NEXT_LANGUAGE = -104;
|
||||||
|
@ -95,18 +94,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLongPress(Key key) {
|
protected boolean onLongPress(Key key) {
|
||||||
if (key.codes[0] == Keyboard.KEYCODE_MODE_CHANGE) {
|
if (key.codes[0] == '0' && getKeyboard() == mPhoneKeyboard) {
|
||||||
getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS, null,
|
|
||||||
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
|
|
||||||
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE);
|
|
||||||
return true;
|
|
||||||
} else if (key.codes[0] == Keyboard.KEYCODE_SHIFT) {
|
|
||||||
getOnKeyboardActionListener().onKey(KEYCODE_SHIFT_LONGPRESS, null,
|
|
||||||
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
|
|
||||||
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE);
|
|
||||||
invalidateAllKeys();
|
|
||||||
return true;
|
|
||||||
} else if (key.codes[0] == '0' && getKeyboard() == mPhoneKeyboard) {
|
|
||||||
// Long pressing on 0 in phone number keypad gives you a '+'.
|
// Long pressing on 0 in phone number keypad gives you a '+'.
|
||||||
getOnKeyboardActionListener().onKey(
|
getOnKeyboardActionListener().onKey(
|
||||||
'+', null, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
|
'+', null, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
|
||||||
|
|
Loading…
Reference in New Issue