Merge pull request #2399 from koppa/enter_confirm

PassPhraseDialog: confirm password on enter key
This commit is contained in:
Vincent Breitmoser 2018-10-02 16:14:43 +02:00 committed by GitHub
commit c765bef79d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -651,7 +651,11 @@ public class PassphraseDialogActivity extends FragmentActivity {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
// Associate the "done" button on the soft keyboard with the okay button in the view
if (EditorInfo.IME_ACTION_DONE == actionId) {
// and the Enter Key, in case a hard keyboard is used
if (EditorInfo.IME_ACTION_DONE == actionId ||
(actionId == EditorInfo.IME_ACTION_UNSPECIFIED &&
event.getAction() == KeyEvent.ACTION_DOWN &&
event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
AlertDialog dialog = ((AlertDialog) getDialog());
Button bt = dialog.getButton(AlertDialog.BUTTON_POSITIVE);