Skip to content

Commit

Permalink
Fix scenario causing termux-dialog to hang (#200)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cvirostek authored and fornwall committed Jul 26, 2018
1 parent fc8daea commit da5b911
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 1 addition & 10 deletions app/src/main/java/com/termux/api/DialogActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
*/
public class DialogActivity extends AppCompatActivity {

static boolean resultReturned = false;
private boolean resultReturned = false;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -82,15 +82,6 @@ protected void onNewIntent(Intent intent) {
setIntent(intent);
}

@Override
protected void onPause() {
super.onPause();

if (!resultReturned) {
postResult(this, null);
}
}

@Override
protected void onDestroy() {
super.onDestroy();
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/termux/api/TermuxApiReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void onReceive(Context context, Intent intent) {
}
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);
Expand Down

0 comments on commit da5b911

Please sign in to comment.