SDL: show download error dialog for SDL2

This commit is contained in:
Sergii Pylypenko
2022-01-09 18:45:54 +02:00
parent 91e6c9f28e
commit 821196ab38
2 changed files with 17 additions and 2 deletions

View File

@@ -214,7 +214,6 @@ class DataDownloader extends Thread
downloadFiles[i].contains("<ARCH>") &&
! DownloadDataFile(downloadFiles[i].replace("<ARCH>", android.os.Build.CPU_ABI2), DOWNLOAD_FLAG_FILENAME + String.valueOf(i) + ".flag", count+1, total, i) ) )
{
DownloadFailed = true;
if (!Parent.getFilesDir().getAbsolutePath().equals(Globals.DataDir))
{
Globals.DataDir = Parent.getFilesDir().getAbsolutePath();
@@ -876,7 +875,6 @@ class DataDownloader extends Thread
public StatusWriter Status;
public boolean DownloadComplete = false;
public boolean DownloadFailed = false;
public boolean DownloadCanBeResumed = false;
private MainActivity Parent;
private String outFilesDir = null;

View File

@@ -96,6 +96,23 @@ public class MainActivity extends org.libsdl.app.SDLActivity {
}
public void downloadFinishedInitSDL() {
if (!this.dataDownloader.downloadCompete)
{
Log.i("SDL", "Data download failed!");
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
dlgAlert.setMessage(res.getString(R.string.error_dl_from, Globals.DataDownloadUrl));
dlgAlert.setTitle("SDL Error");
dlgAlert.setPositiveButton("Exit",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,int id) {
System.exit(0);
}
});
dlgAlert.setCancelable(false);
dlgAlert.create().show();
return;
}
Log.i("SDL", "Data download finished, starting native thread");
this.dataDownloader = null;
if (this.nativeThreadResumeCaptured)