1
0
Fork 0

new dev bug: fixed number keys typing while the language selection dialog is displayed

This commit is contained in:
sspanak 2025-05-27 22:48:58 +03:00 committed by Dimo Karaivanov
parent 9e98475634
commit 2b79e6ad66

View file

@ -1,6 +1,7 @@
package io.github.sspanak.tt9.ui.dialogs; package io.github.sspanak.tt9.ui.dialogs;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Handler;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -51,7 +52,7 @@ public class ChangeLanguageDialog extends PopupDialog {
@Override @Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (Key.isBack(keyCode)) { if (Key.isBack(keyCode)) {
close(); closeAsync();
return true; return true;
} }
@ -72,7 +73,10 @@ public class ChangeLanguageDialog extends PopupDialog {
if (onLanguageChanged != null) { if (onLanguageChanged != null) {
onLanguageChanged.accept(languageId); onLanguageChanged.accept(languageId);
} }
close();
// close after returning to prevent the key event from leaking into the current input field
closeAsync();
return true; return true;
} }
@ -93,6 +97,11 @@ public class ChangeLanguageDialog extends PopupDialog {
} }
private void closeAsync() {
new Handler().post(this::close);
}
@Override @Override
protected void close() { protected void close() {
detachRadioButtons(); detachRadioButtons();