Issue #17 - don't keep trying to update from an invalid repo

This commit is contained in:
Ciaran Gultnieks 2010-12-08 13:45:24 +00:00
parent 364fe8fe0e
commit bcd0b185dc

View File

@ -163,6 +163,8 @@ public class FDroid extends TabActivity implements OnItemClickListener {
private TabSpec ts1; private TabSpec ts1;
private TabSpec tsUp; private TabSpec tsUp;
private boolean triedEmptyUpdate;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -195,6 +197,7 @@ public class FDroid extends TabActivity implements OnItemClickListener {
super.onStart(); super.onStart();
((FDroidApp) getApplication()).inActivity++; ((FDroidApp) getApplication()).inActivity++;
db = new DB(this); db = new DB(this);
triedEmptyUpdate=false;
populateLists(true); populateLists(true);
} }
@ -374,19 +377,24 @@ public class FDroid extends TabActivity implements OnItemClickListener {
// by asking the system. // by asking the system.
private void populateLists(boolean update) { private void populateLists(boolean update) {
apps_in.clear();
apps_av.clear();
apps_up.clear();
Vector<DB.App> apps = db.getApps(null, null, update); Vector<DB.App> apps = db.getApps(null, null, update);
if(apps.isEmpty()) { if(apps.isEmpty()) {
// Don't attempt this more than once - we may have invalid repositories.
if(triedEmptyUpdate)
return;
// If there are no apps, update from the repos - it must be a // If there are no apps, update from the repos - it must be a
// new installation. // new installation.
Log.d("FDroid", "Empty app list forces repo update"); Log.d("FDroid", "Empty app list forces repo update");
updateRepos(); updateRepos();
triedEmptyUpdate = true;
return; return;
} }
Log.d("FDroid", "Updating lists - " + apps.size() + " apps in total"); Log.d("FDroid", "Updating lists - " + apps.size() + " apps in total");
apps_in.clear();
apps_av.clear();
apps_up.clear();
for (DB.App app : apps) { for (DB.App app : apps) {
if (app.installedVersion == null) { if (app.installedVersion == null) {
apps_av.addItem(app); apps_av.addItem(app);