Close the application if downloads failed, when user presses Back key

This commit is contained in:
pelya
2010-09-20 15:26:48 +03:00
parent 37df37fc4b
commit 164464257c
3 changed files with 11 additions and 2 deletions

View File

@@ -155,7 +155,10 @@ class DataDownloader extends Thread
{
if( downloadFiles[i].length() > 0 && Globals.OptionalDataDownload.length > i && Globals.OptionalDataDownload[i] )
if( ! DownloadDataFile(downloadFiles[i], "libsdl-DownloadFinished-" + String.valueOf(i) + ".flag") )
{
DownloadFailed = true;
return;
}
}
DownloadComplete = true;
initParent();
@@ -446,6 +449,7 @@ class DataDownloader extends Thread
public StatusWriter Status;
public boolean DownloadComplete = false;
public boolean DownloadFailed = false;
private MainActivity Parent;
private String outFilesDir = null;
}

View File

@@ -100,8 +100,13 @@ public class MainActivity extends Activity {
if( mGLView != null )
mGLView.nativeKey( keyCode, 1 );
else
if( keyCode == KeyEvent.KEYCODE_BACK && downloader != null && !downloader.DownloadComplete )
if( keyCode == KeyEvent.KEYCODE_BACK && downloader != null )
{
if( downloader.DownloadFailed )
System.exit(1);
if( !downloader.DownloadComplete )
onStop();
}
return true;
}

View File

@@ -111,7 +111,7 @@ class Settings
public void run()
{
try {
Thread.sleep(1500);
Thread.sleep(2000);
} catch( InterruptedException e ) {};
if( changeConfigAlert == null )
return;