Fix Bug #1833943 - CapsLock using long-press doesn't update keys.

Use new API in KeyboardView to invalidate all keys on long-press of shift key.
main
Amith Yamasani 2009-05-06 17:38:00 -07:00
parent bd9fdede8f
commit 230cd6f7f2
1 changed files with 4 additions and 4 deletions

View File

@ -33,7 +33,7 @@ public class LatinKeyboardView extends KeyboardView {
static final int KEYCODE_OPTIONS = -100; static final int KEYCODE_OPTIONS = -100;
static final int KEYCODE_SHIFT_LONGPRESS = -101; static final int KEYCODE_SHIFT_LONGPRESS = -101;
private Keyboard mPhoneKeyboard; private Keyboard mPhoneKeyboard;
public LatinKeyboardView(Context context, AttributeSet attrs) { public LatinKeyboardView(Context context, AttributeSet attrs) {
@ -43,11 +43,11 @@ public class LatinKeyboardView extends KeyboardView {
public LatinKeyboardView(Context context, AttributeSet attrs, int defStyle) { public LatinKeyboardView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
} }
public void setPhoneKeyboard(Keyboard phoneKeyboard) { public void setPhoneKeyboard(Keyboard phoneKeyboard) {
mPhoneKeyboard = phoneKeyboard; mPhoneKeyboard = phoneKeyboard;
} }
@Override @Override
protected boolean onLongPress(Key key) { protected boolean onLongPress(Key key) {
if (key.codes[0] == Keyboard.KEYCODE_MODE_CHANGE) { if (key.codes[0] == Keyboard.KEYCODE_MODE_CHANGE) {
@ -55,7 +55,7 @@ public class LatinKeyboardView extends KeyboardView {
return true; return true;
} else if (key.codes[0] == Keyboard.KEYCODE_SHIFT) { } else if (key.codes[0] == Keyboard.KEYCODE_SHIFT) {
getOnKeyboardActionListener().onKey(KEYCODE_SHIFT_LONGPRESS, null); getOnKeyboardActionListener().onKey(KEYCODE_SHIFT_LONGPRESS, null);
invalidate(); invalidateAllKeys();
return true; return true;
} else if (key.codes[0] == '0' && getKeyboard() == mPhoneKeyboard) { } 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 '+'.