Added common compose keynoard shortcuts

This commit is contained in:
M66B 2020-06-21 20:58:31 +02:00
parent af4734c9a9
commit 874a5c396e
1 changed files with 22 additions and 3 deletions

View File

@ -4786,10 +4786,29 @@ public class FragmentCompose extends FragmentBase {
private ActivityBase.IKeyPressedListener onKeyPressedListener = new ActivityBase.IKeyPressedListener() { private ActivityBase.IKeyPressedListener onKeyPressedListener = new ActivityBase.IKeyPressedListener() {
@Override @Override
public boolean onKeyPressed(KeyEvent event) { public boolean onKeyPressed(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER && event.isCtrlPressed()) { if (event.isCtrlPressed() && event.getAction() == KeyEvent.ACTION_DOWN) {
onAction(R.id.action_send, "enter"); switch (event.getKeyCode()) {
return true; case KeyEvent.KEYCODE_ENTER:
onAction(R.id.action_send, "enter");
return true;
case KeyEvent.KEYCODE_B:
if (etBody.hasSelection())
return StyleHelper.apply(R.id.menu_bold, etBody);
else
return false;
case KeyEvent.KEYCODE_I:
if (etBody.hasSelection())
return StyleHelper.apply(R.id.menu_italic, etBody);
else
return false;
case KeyEvent.KEYCODE_U:
if (etBody.hasSelection())
return StyleHelper.apply(R.id.menu_underline, etBody);
else
return false;
}
} }
return false; return false;
} }