Update repo index when relevant preferences changed

This commit is contained in:
Ciaran Gultnieks 2012-09-16 11:55:01 +01:00
parent 717df0b82f
commit 18b40b25b3
2 changed files with 19 additions and 5 deletions

View File

@ -260,7 +260,8 @@ public class FDroid extends TabActivity implements OnItemClickListener,
// unschedule) the service accordingly. It's cheap, so no need to
// check if the particular setting has actually been changed.
UpdateService.schedule(getBaseContext());
if (data != null && data.hasExtra("reset")) {
if (data != null
&& (data.hasExtra("reset") || data.hasExtra("update"))) {
updateRepos();
} else {
populateLists();

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 Ciaran Gultnieks, ciaran@ciarang.com
* Copyright (C) 2010-12 Ciaran Gultnieks, ciaran@ciarang.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -64,13 +64,25 @@ public class Preferences extends PreferenceActivity {
.show();
Intent ret = new Intent();
ret.putExtra("reset", true);
setResult(RESULT_OK, ret);
setResult(RESULT_OK, ret);
finish();
return true;
}
});
r = (Preference) findPreference("ignoreTouchscreen");
r.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
Intent ret = new Intent();
ret.putExtra("update", true);
setResult(RESULT_OK, ret);
return true;
}
});
}
private void deleteAll(File dir) {
@ -84,4 +96,5 @@ public class Preferences extends PreferenceActivity {
dir.delete();
}
}