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 // unschedule) the service accordingly. It's cheap, so no need to
// check if the particular setting has actually been changed. // check if the particular setting has actually been changed.
UpdateService.schedule(getBaseContext()); UpdateService.schedule(getBaseContext());
if (data != null && data.hasExtra("reset")) { if (data != null
&& (data.hasExtra("reset") || data.hasExtra("update"))) {
updateRepos(); updateRepos();
} else { } else {
populateLists(); 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -38,7 +38,7 @@ public class Preferences extends PreferenceActivity {
r.setOnPreferenceClickListener(new OnPreferenceClickListener() { r.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
// TODO: Progress dialog + thread is needed, it can take a // TODO: Progress dialog + thread is needed, it can take a
// while to delete all the icons and cached apks in a long // while to delete all the icons and cached apks in a long
// standing install! // standing install!
@ -64,15 +64,27 @@ public class Preferences extends PreferenceActivity {
.show(); .show();
Intent ret = new Intent(); Intent ret = new Intent();
ret.putExtra("reset", true); ret.putExtra("reset", true);
setResult(RESULT_OK, ret); setResult(RESULT_OK, ret);
finish(); finish();
return true; 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) { private void deleteAll(File dir) {
if (dir.isDirectory()) { if (dir.isDirectory()) {
@ -84,4 +96,5 @@ public class Preferences extends PreferenceActivity {
dir.delete(); dir.delete();
} }
} }