SDL: data downloader from SDL2, it will not print anything to screen so please don't put big files there

This commit is contained in:
Sergii Pylypenko
2022-01-09 17:44:45 +02:00
parent 1f88f05321
commit 79c0dc8b96
4 changed files with 51 additions and 59 deletions

View File

@@ -192,9 +192,6 @@ class DataDownloader extends Thread
@Override
public void run()
{
if (Parent.getVideoLayout() != null)
Parent.getVideoLayout().setOnKeyListener(new BackKeyListener(Parent));
String [] downloadFiles = Globals.DataDownloadUrl;
int total = 0;
int count = 0;
@@ -235,8 +232,6 @@ class DataDownloader extends Thread
}
}
DownloadComplete = true;
if (Parent.getVideoLayout() != null)
Parent.getVideoLayout().setOnKeyListener(null);
initParent();
}
@@ -879,52 +874,6 @@ class DataDownloader extends Thread
Parent.getPackageName() + "/" + url.substring("obb:".length()) + "." + Parent.getPackageName() + ".obb";
}
public class BackKeyListener implements View.OnKeyListener
{
MainActivity p;
public BackKeyListener(MainActivity _p)
{
p = _p;
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if( DownloadFailed )
System.exit(1);
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.cancel_download));
builder.setMessage(p.getResources().getString(R.string.cancel_download) + (DownloadCanBeResumed ? " " + p.getResources().getString(R.string.cancel_download_resume) : ""));
builder.setPositiveButton(p.getResources().getString(R.string.yes), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
System.exit(1);
dialog.dismiss();
}
});
builder.setNegativeButton(p.getResources().getString(R.string.no), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
return true;
}
}
public StatusWriter Status;
public boolean DownloadComplete = false;
public boolean DownloadFailed = false;