mirror of
https://github.com/nix-community/nix-on-droid-app.git
synced 2025-12-04 08:01:08 +01:00
Fixed issue where back button would not exit the activity if bootstrap installation failed and users dismissed the error dialog,
This commit is contained in:
parent
e408fdcc08
commit
9c92251595
2 changed files with 11 additions and 1 deletions
|
|
@ -245,6 +245,13 @@ public class TermuxTerminalViewClient extends TermuxTerminalViewClientBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent e) {
|
public boolean onKeyUp(int keyCode, KeyEvent e) {
|
||||||
|
// If emulator is not set, like if bootstrap installation failed and user dismissed the error
|
||||||
|
// dialog, then just exit the activity, otherwise they will be stuck in a broken state.
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BACK && mActivity.getTerminalView().mEmulator == null) {
|
||||||
|
mActivity.finishActivityIfNotFinishing();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return handleVirtualKeys(keyCode, e, false);
|
return handleVirtualKeys(keyCode, e, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -720,7 +720,10 @@ public final class TerminalView extends View {
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||||
if (TERMINAL_VIEW_KEY_LOGGING_ENABLED)
|
if (TERMINAL_VIEW_KEY_LOGGING_ENABLED)
|
||||||
mClient.logInfo(LOG_TAG, "onKeyUp(keyCode=" + keyCode + ", event=" + event + ")");
|
mClient.logInfo(LOG_TAG, "onKeyUp(keyCode=" + keyCode + ", event=" + event + ")");
|
||||||
if (mEmulator == null) return true;
|
|
||||||
|
// Do not return for KEYCODE_BACK and send it to the client since user may be trying
|
||||||
|
// to exit the activity.
|
||||||
|
if (mEmulator == null && keyCode != KeyEvent.KEYCODE_BACK) return true;
|
||||||
|
|
||||||
if (mClient.onKeyUp(keyCode, event)) {
|
if (mClient.onKeyUp(keyCode, event)) {
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue