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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
@@ -150,7 +150,7 @@ class DataDownloader extends Thread
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
String [] downloadFiles = Globals.DataDownloadUrl.split("[^]");
|
||||
String [] downloadFiles = Globals.DataDownloadUrl.split("\\^");
|
||||
for( int i = 0; i < downloadFiles.length; i++ )
|
||||
{
|
||||
if( downloadFiles[i].length() > 0 && Globals.OptionalDataDownload.length > i && Globals.OptionalDataDownload[i] )
|
||||
@@ -258,7 +258,11 @@ class DataDownloader extends Thread
|
||||
|
||||
if(DoNotUnzip)
|
||||
{
|
||||
path = downloadUrls[downloadUrlIndex].substring(downloadUrls[downloadUrlIndex].lastIndexOf("/")+1, downloadUrls[downloadUrlIndex].indexOf("?"));
|
||||
path = getOutFilePath(downloadUrls[downloadUrlIndex].substring(
|
||||
downloadUrls[downloadUrlIndex].lastIndexOf("/")+1,
|
||||
downloadUrls[downloadUrlIndex].indexOf("?") > 0 ?
|
||||
downloadUrls[downloadUrlIndex].indexOf("?") :
|
||||
downloadUrls[downloadUrlIndex].length() ));
|
||||
OutputStream out = null;
|
||||
try {
|
||||
out = new FileOutputStream( path );
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
fixed with a hammer and rasp to work with libSDL port */
|
||||
|
||||
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
|
||||
package com.googlecode.opentyrian;
|
||||
package com.sourceforge.sc2;
|
||||
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount anywhere
|
||||
package com.googlecode.opentyrian;
|
||||
package com.sourceforge.sc2;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
class Globals {
|
||||
public static String ApplicationName = "OpenTyrian";
|
||||
public static String ApplicationName = "Ur-QuanMasters";
|
||||
|
||||
// Should be zip file
|
||||
public static String DataDownloadUrl = "^Data files size is 10 Mb|http://sites.google.com/site/xpelyax/Home/tyrian21-data.zip?attredirects=0%26d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/tyrian21-data.zip";
|
||||
public static String DataDownloadUrl = "Main game data is 11 Mb|-http://prdownloads.sourceforge.net/sc2/uqm-0.6.0-content.uqm?download^3DO music (19 Mb)|-http://prdownloads.sourceforge.net/sc2/uqm-0.6.0-3domusic.uqm?download^UQM music remix pack 1 (50 Mb)|-http://prdownloads.sourceforge.net/sc2/uqm-remix-pack1.zip?download^UQM music remix pack 2 (60 Mb)|-http://prdownloads.sourceforge.net/sc2/uqm-remix-pack2.zip?download^UQM music remix pack 3 (40 Mb)|-http://prdownloads.sourceforge.net/sc2/uqm-remix-pack3.zip?download^Voice (115 Mb)|http://prdownloads.sourceforge.net/sc2/uqm-0.6.0-voice.uqm?download";
|
||||
|
||||
// Set this value to true if you're planning to render 3D using OpenGL - it eats some GFX resources, so disabled for 2D
|
||||
public static boolean NeedDepthBuffer = false;
|
||||
@@ -27,7 +27,7 @@ class Globals {
|
||||
|
||||
public static boolean AppUsesMultitouch = false;
|
||||
|
||||
public static int AppTouchscreenKeyboardKeysAmount = 4;
|
||||
public static int AppTouchscreenKeyboardKeysAmount = 2;
|
||||
|
||||
// Phone-specific config
|
||||
// It will download app data to /sdcard/alienblaster if set to true,
|
||||
@@ -45,5 +45,5 @@ class Globals {
|
||||
}
|
||||
|
||||
class LoadLibrary {
|
||||
public LoadLibrary() { System.loadLibrary("sdl"); System.loadLibrary("sdl_net"); };
|
||||
public LoadLibrary() { System.loadLibrary("sdl"); System.loadLibrary("sdl_image"); };
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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 javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user