mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 10:45:23 +08: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:
@@ -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();
|
||||||
|
Reference in New Issue
Block a user