This commit is contained in:
PaulStets 2017-09-22 18:47:01 +03:00
parent 575c3df8c4
commit 72807105b9
2 changed files with 9 additions and 1 deletions

View file

@ -239,8 +239,9 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
final IncrementalChangesManager changesManager =
getMyApplication().getResourceManager().getChangesManager();
final File baseFile = new File(localIndexInfo);
final String fileNameWithoutExtension =
Algorithms.getFileNameWithoutExtension(new File(localIndexInfo));
Algorithms.getFileNameWithoutExtension(baseFile);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(getString(R.string.clear_updates_proposition_message)
+ " " + getUpdatesSize(fileNameWithoutExtension, changesManager))
@ -248,6 +249,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
@Override
public void onClick(DialogInterface dialog, int which) {
changesManager.deleteUpdates(fileNameWithoutExtension);
changesManager.removeRegionUpdateReferences(fileNameWithoutExtension);
preferenceLastCheck(localIndexInfo, getMyApplication().getSettings()).resetToDefault();
}
})

View file

@ -333,6 +333,12 @@ public class IncrementalChangesManager {
return iul;
}
public void removeRegionUpdateReferences(String fileName) {
RegionUpdateFiles ruf = regions.get(fileName.toLowerCase());
ruf.monthUpdates.clear();
ruf.dayUpdates.clear();
}
public long getUpdatesSize(String fileName){
RegionUpdateFiles ruf = regions.get(fileName.toLowerCase());
if(ruf == null) {