Fixed data downloading
This commit is contained in:
@@ -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;
|
||||
@@ -154,29 +154,8 @@ class Settings
|
||||
|
||||
final CharSequence[] items = {"Phone storage - " + String.valueOf(freePhone) + " Mb free", "SD card - " + String.valueOf(freeSdcard) + " Mb free"};
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
String [] downloadFiles = Globals.DataDownloadUrl.split("[^]");
|
||||
String [] downloadFiles = Globals.DataDownloadUrl.split("\\^");
|
||||
builder.setTitle(downloadFiles[0].split("[|]")[0]);
|
||||
CharSequence[] items2 = null;
|
||||
if(downloadFiles.length > 1)
|
||||
{
|
||||
Globals.OptionalDataDownload = new boolean[downloadFiles.length];
|
||||
items2 = new CharSequence[ downloadFiles.length - 1 ];
|
||||
for(int i = 1; i < downloadFiles.length; i++ )
|
||||
items2[i-1] = new String(downloadFiles[i].split("[|]")[0]);
|
||||
if( items2 != null )
|
||||
builder.setMultiChoiceItems(items2,
|
||||
Globals.OptionalDataDownload.length == items2.length ? Globals.OptionalDataDownload : null,
|
||||
new DialogInterface.OnMultiChoiceClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item, boolean isChecked)
|
||||
{
|
||||
Globals.OptionalDataDownload[item+1] = isChecked;
|
||||
}
|
||||
});
|
||||
}
|
||||
if( Globals.OptionalDataDownload == null )
|
||||
Globals.OptionalDataDownload = new boolean[1];
|
||||
Globals.OptionalDataDownload[0] = true;
|
||||
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item)
|
||||
@@ -184,7 +163,7 @@ class Settings
|
||||
Globals.DownloadToSdcard = (item == 1);
|
||||
|
||||
dialog.dismiss();
|
||||
showKeyboardConfig(p);
|
||||
showOptionalDownloadConfig(p);
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
@@ -192,6 +171,47 @@ class Settings
|
||||
alert.show();
|
||||
};
|
||||
|
||||
static void showOptionalDownloadConfig(final MainActivity p) {
|
||||
|
||||
String [] downloadFiles = Globals.DataDownloadUrl.split("\\^");
|
||||
if(downloadFiles.length <= 1)
|
||||
{
|
||||
showKeyboardConfig(p);
|
||||
return;
|
||||
}
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
builder.setTitle("Optional packages");
|
||||
|
||||
CharSequence[] items = new CharSequence[ downloadFiles.length - 1 ];
|
||||
for(int i = 1; i < downloadFiles.length; i++ )
|
||||
items[i-1] = new String(downloadFiles[i].split("[|]")[0]);
|
||||
|
||||
if( Globals.OptionalDataDownload == null || Globals.OptionalDataDownload.length != items.length + 1 )
|
||||
Globals.OptionalDataDownload = new boolean[downloadFiles.length];
|
||||
Globals.OptionalDataDownload[0] = true;
|
||||
|
||||
builder.setMultiChoiceItems(items, null, new DialogInterface.OnMultiChoiceClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item, boolean isChecked)
|
||||
{
|
||||
Globals.OptionalDataDownload[item+1] = isChecked;
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton("Done", new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item)
|
||||
{
|
||||
dialog.dismiss();
|
||||
showKeyboardConfig(p);
|
||||
}
|
||||
});
|
||||
|
||||
AlertDialog alert = builder.create();
|
||||
alert.setOwnerActivity(p);
|
||||
alert.show();
|
||||
};
|
||||
|
||||
static void showKeyboardConfig(final MainActivity p)
|
||||
{
|
||||
if( ! Globals.AppNeedsArrowKeys )
|
||||
|
||||
Reference in New Issue
Block a user