do tab completion only if neither ctrl nor alt are being pressed

This commit is contained in:
Daniel Gultsch 2015-09-28 14:36:10 +02:00
parent f4d6b676e9
commit 8881b71079

View file

@ -37,13 +37,13 @@ public class EditMessage extends EditText {
protected KeyboardListener keyboardListener; protected KeyboardListener keyboardListener;
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent e) {
if (keyCode == KeyEvent.KEYCODE_ENTER && !event.isShiftPressed()) { if (keyCode == KeyEvent.KEYCODE_ENTER && !e.isShiftPressed()) {
lastInputWasTab = false; lastInputWasTab = false;
if (keyboardListener != null && keyboardListener.onEnterPressed()) { if (keyboardListener != null && keyboardListener.onEnterPressed()) {
return true; return true;
} }
} else if (keyCode == KeyEvent.KEYCODE_TAB) { } else if (keyCode == KeyEvent.KEYCODE_TAB && !e.isAltPressed() && !e.isCtrlPressed()) {
if (keyboardListener != null && keyboardListener.onTabPressed(this.lastInputWasTab)) { if (keyboardListener != null && keyboardListener.onTabPressed(this.lastInputWasTab)) {
lastInputWasTab = true; lastInputWasTab = true;
return true; return true;
@ -51,7 +51,7 @@ public class EditMessage extends EditText {
} else { } else {
lastInputWasTab = false; lastInputWasTab = false;
} }
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, e);
} }
@Override @Override