Navigation Menu

Skip to content

Commit

Permalink
Android: fix deprecated onCreateDialog() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
1bsyl committed Oct 24, 2020
1 parent 5dc6c3c commit 0360987
Showing 1 changed file with 5 additions and 9 deletions.
Expand Up @@ -1233,9 +1233,6 @@ public static void initTouch() {
/** Result of current messagebox. Also used for blocking the calling thread. */
protected final int[] messageboxSelection = new int[1];

/** Id of current dialog. */
protected int dialogs = 0;

/**
* This method is called by SDL using JNI.
* Shows the messagebox from UI thread and block calling thread.
Expand Down Expand Up @@ -1279,7 +1276,7 @@ public int messageboxShowMessageBox(
runOnUiThread(new Runnable() {
@Override
public void run() {
showDialog(dialogs++, args);
messageboxCreateAndShow(args);
}
});

Expand All @@ -1299,8 +1296,7 @@ public void run() {
return messageboxSelection[0];
}

@Override
protected Dialog onCreateDialog(int ignore, Bundle args) {
protected void messageboxCreateAndShow(Bundle args) {

// TODO set values from "flags" to messagebox dialog

Expand Down Expand Up @@ -1329,7 +1325,7 @@ protected Dialog onCreateDialog(int ignore, Bundle args) {

// create dialog with title and a listener to wake up calling thread

final Dialog dialog = new Dialog(this);
final AlertDialog dialog = new AlertDialog.Builder(this).create();
dialog.setTitle(args.getString("title"));
dialog.setCancelable(false);
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
Expand Down Expand Up @@ -1415,7 +1411,7 @@ public void onClick(View v) {

// add content to dialog and return

dialog.setContentView(content);
dialog.setView(content);
dialog.setOnKeyListener(new Dialog.OnKeyListener() {
@Override
public boolean onKey(DialogInterface d, int keyCode, KeyEvent event) {
Expand All @@ -1430,7 +1426,7 @@ public boolean onKey(DialogInterface d, int keyCode, KeyEvent event) {
}
});

return dialog;
dialog.show();
}

private final Runnable rehideSystemUi = new Runnable() {
Expand Down

0 comments on commit 0360987

Please sign in to comment.