mirror of
https://github.com/danog/termux-api.git
synced 2024-11-30 04:19:20 +01:00
Fix scenario causing termux-dialog to hang (#200)
If termux-dialog is called while Termux already has a dialog open, the new dialog fails to open and the command will hang until it is manually terminated. This fix allows multiple dialogs to be open at once, ensuring that termux-dialog will not hang.
This commit is contained in:
parent
fc8daead89
commit
da5b9111d0
@ -55,7 +55,7 @@ import java.util.Objects;
|
||||
*/
|
||||
public class DialogActivity extends AppCompatActivity {
|
||||
|
||||
static boolean resultReturned = false;
|
||||
private boolean resultReturned = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -82,15 +82,6 @@ public class DialogActivity extends AppCompatActivity {
|
||||
setIntent(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
if (!resultReturned) {
|
||||
postResult(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
@ -64,7 +64,7 @@ public class TermuxApiReceiver extends BroadcastReceiver {
|
||||
}
|
||||
break;
|
||||
case "Dialog":
|
||||
context.startActivity(new Intent(context, DialogActivity.class).putExtras(intent.getExtras()).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
context.startActivity(new Intent(context, DialogActivity.class).putExtras(intent.getExtras()).addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK));
|
||||
break;
|
||||
case "Download":
|
||||
DownloadAPI.onReceive(this, context, intent);
|
||||
|
Loading…
Reference in New Issue
Block a user