mirror of
https://github.com/danog/termux-api.git
synced 2025-01-22 21:31:10 +01:00
termux-dialog: Exit when back is pressed
This treats pressing the back button the same as pressing cancel. Fixes #78.
This commit is contained in:
parent
2c62ab229a
commit
3e1bbea265
@ -54,17 +54,7 @@ public class DialogActivity extends Activity {
|
||||
findViewById(R.id.cancel_button).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ResultReturner.returnData(DialogActivity.this, getIntent(), new ResultWriter() {
|
||||
@Override
|
||||
public void writeResult(PrintWriter out) throws Exception {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
onBackPressed();
|
||||
}
|
||||
});
|
||||
|
||||
@ -94,4 +84,19 @@ public class DialogActivity extends Activity {
|
||||
setIntent(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
ResultReturner.returnData(DialogActivity.this, getIntent(), new ResultWriter() {
|
||||
@Override
|
||||
public void writeResult(PrintWriter out) throws Exception {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user