Android: fix deprecated onCreateDialog() methods

This commit is contained in:
Sylvain Becker 2020-10-24 20:31:04 +02:00
parent 5dc6c3c951
commit 0360987f45

View File

@ -1233,9 +1233,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
/** 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.
@ -1279,7 +1276,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
runOnUiThread(new Runnable() {
@Override
public void run() {
showDialog(dialogs++, args);
messageboxCreateAndShow(args);
}
});
@ -1299,8 +1296,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
return messageboxSelection[0];
}
@Override
protected Dialog onCreateDialog(int ignore, Bundle args) {
protected void messageboxCreateAndShow(Bundle args) {
// TODO set values from "flags" to messagebox dialog
@ -1329,7 +1325,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
// 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() {
@ -1415,7 +1411,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
// 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) {
@ -1430,7 +1426,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
});
return dialog;
dialog.show();
}
private final Runnable rehideSystemUi = new Runnable() {