Fixed data downloader not downloading optional packages

This commit is contained in:
pelya
2010-08-27 15:42:44 +03:00
parent 1330aec692
commit 6bd7d4126f
14 changed files with 233 additions and 230 deletions

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package com.sourceforge.sc2;
import android.app.Activity;
import android.content.Context;
@@ -26,6 +26,7 @@ class Settings
static AlertDialog changeConfigAlert = null;
static Thread changeConfigAlertThread = null;
static boolean settingsLoaded = false;
static void Save(final MainActivity p)
{
@@ -45,6 +46,8 @@ class Settings
out.writeBoolean(Globals.OptionalDataDownload[i]);
out.writeInt(Globals.TouchscreenKeyboardTheme);
out.close();
settingsLoaded = true;
} catch( FileNotFoundException e ) {
} catch( SecurityException e ) {
} catch ( IOException e ) {};
@@ -52,6 +55,11 @@ class Settings
static void Load( final MainActivity p )
{
if(settingsLoaded) // Prevent starting twice
{
startDownloader(p);
return;
}
try {
ObjectInputStream settingsFile = new ObjectInputStream(new FileInputStream( p.getFilesDir().getAbsolutePath() + "/" + SettingsFileName ));
Globals.DownloadToSdcard = settingsFile.readBoolean();
@@ -68,6 +76,8 @@ class Settings
Globals.OptionalDataDownload[i] = settingsFile.readBoolean();
Globals.TouchscreenKeyboardTheme = settingsFile.readInt();
settingsLoaded = true;
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("Phone configuration");
builder.setPositiveButton("Change phone configuration", new DialogInterface.OnClickListener()
@@ -113,8 +123,7 @@ class Settings
changeConfigAlertThread.start();
alert.show();
return;
} catch( FileNotFoundException e ) {