refresh setting summary after download

This commit is contained in:
sonora 2015-04-12 11:59:59 +02:00
parent 8706cb6aa7
commit 865c9668a1

View file

@ -97,13 +97,12 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
//setEnabled(false) creates bad readability on some devices
//pref.setEnabled(false);
cat.addPreference(pref);
long agpsLastDownloaded = settings.AGPS_DATA_LAST_TIME_DOWNLOADED.get();
pref = new Preference(this);
pref.setTitle(R.string.agps_info);
if (agpsLastDownloaded != 0L) {
if (settings.AGPS_DATA_LAST_TIME_DOWNLOADED.get() != 0L) {
SimpleDateFormat prt = new SimpleDateFormat("yyyy-MM-dd HH:mm");
pref.setSummary(getString(R.string.agps_data_last_downloaded, prt.format(agpsLastDownloaded)));
pref.setSummary(getString(R.string.agps_data_last_downloaded, prt.format(settings.AGPS_DATA_LAST_TIME_DOWNLOADED.get())));
} else {
pref.setSummary(getString(R.string.agps_data_last_downloaded, "--"));
}
@ -117,6 +116,8 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
getMyApplication().getLocationProvider().redownloadAGPS();
if(getMyApplication().getLocationProvider().agpsDownloaded() == true) {
getMyApplication().getSettings().AGPS_DATA_LAST_TIME_DOWNLOADED.set(System.currentTimeMillis());
SimpleDateFormat prt = new SimpleDateFormat("yyyy-MM-dd HH:mm");
pref.setSummary(getString(R.string.agps_data_last_downloaded, prt.format(settings.AGPS_DATA_LAST_TIME_DOWNLOADED.get())));
//for debugging only: try catch issue here where A-GPS data sometimes seems destroyed but not reloaded
//} else {
// getMyApplication().getSettings().AGPS_DATA_LAST_TIME_DOWNLOADED.set(0L);