Fix timeout on image database download.
This commit is contained in:
@@ -365,7 +365,6 @@ public class SDLActivity extends Activity implements OnKeyListener {
|
|||||||
boolean[] checkedSet;
|
boolean[] checkedSet;
|
||||||
Integer totalset = 0;
|
Integer totalset = 0;
|
||||||
boolean finished = false;
|
boolean finished = false;
|
||||||
boolean finished2 = false;
|
|
||||||
boolean loadResInProgress = false;
|
boolean loadResInProgress = false;
|
||||||
ProgressDialog progressBarDialogRes;
|
ProgressDialog progressBarDialogRes;
|
||||||
boolean fast = false;
|
boolean fast = false;
|
||||||
@@ -423,19 +422,14 @@ public class SDLActivity extends Activity implements OnKeyListener {
|
|||||||
progressBarDialogRes.dismiss();
|
progressBarDialogRes.dismiss();
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
while (!finished || !finished2) {
|
while (!finished) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(5000);
|
Thread.sleep(1000);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selectedSets = new ArrayList<String>();
|
selectedSets = new ArrayList<String>();
|
||||||
if(!fast) {
|
showWarningFast();
|
||||||
showWarningFast();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
downloadCardImages();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -444,7 +438,6 @@ public class SDLActivity extends Activity implements OnKeyListener {
|
|||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
fast = ImgDownloader.loadDatabase(getSystemStorageLocation());
|
fast = ImgDownloader.loadDatabase(getSystemStorageLocation());
|
||||||
finished2 = true;
|
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
@@ -453,8 +446,21 @@ public class SDLActivity extends Activity implements OnKeyListener {
|
|||||||
|
|
||||||
private void showWarningFast() {
|
private void showWarningFast() {
|
||||||
AlertDialog.Builder infoDialog = new AlertDialog.Builder(this);
|
AlertDialog.Builder infoDialog = new AlertDialog.Builder(this);
|
||||||
infoDialog.setTitle("Problem downloading the images database file");
|
if(!fast) {
|
||||||
infoDialog.setMessage("The program will use the slow method (not indexed), so the images download may take really long time...");
|
infoDialog.setTitle("Problem downloading the images database file");
|
||||||
|
infoDialog.setMessage("The program will use the slow (not indexed) method, so the images download may take really long time...");
|
||||||
|
|
||||||
|
infoDialog.setNegativeButton("Retry", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
fast = ImgDownloader.loadDatabase(getSystemStorageLocation());
|
||||||
|
showWarningFast();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
infoDialog.setTitle("Images Database correctly downloaded");
|
||||||
|
infoDialog.setMessage("The program will use the fast (indexed) method, so the images download will not take long time!");
|
||||||
|
}
|
||||||
|
|
||||||
infoDialog.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
|
infoDialog.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
@@ -462,17 +468,6 @@ public class SDLActivity extends Activity implements OnKeyListener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
infoDialog.setNegativeButton("Retry", new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
fast = ImgDownloader.loadDatabase(getSystemStorageLocation());
|
|
||||||
if(fast){
|
|
||||||
downloadCardImages();
|
|
||||||
} else {
|
|
||||||
showWarningFast();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
infoDialog.create().show();
|
infoDialog.create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user