Merge pull request #11286 from osmandapp/fix_removing_gpx_from_my_places

Fix removing GPX from "My Places"
This commit is contained in:
Vitaliy 2021-03-29 21:54:46 +03:00 committed by GitHub
commit 001b34c47d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View file

@ -1290,13 +1290,14 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
// local_indexes_cat_gpx now obsolete in new UI screen which shows only GPX data // local_indexes_cat_gpx now obsolete in new UI screen which shows only GPX data
// if (Algorithms.objectEquals(getActivity().getString(R.string.local_indexes_cat_gpx) + " " + // if (Algorithms.objectEquals(getActivity().getString(R.string.local_indexes_cat_gpx) + " " +
// g.subfolder, cat)) { // g.subfolder, cat)) {
if (objectEquals("" + g.subfolder, cat)) { if (objectEquals(g.subfolder, cat)) {
found = i; found = i;
break; break;
} }
} }
if (found != -1) { if (found != -1) {
data.get(category.get(found)).remove(g); data.get(category.get(found)).remove(g);
selected.remove(g);
} }
} }
} }
@ -1507,17 +1508,15 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
int total = 0; int total = 0;
for (GpxInfo info : params) { for (GpxInfo info : params) {
if (!isCancelled() && (info.gpx == null || !info.gpx.showCurrentTrack)) { if (!isCancelled() && (info.gpx == null || !info.gpx.showCurrentTrack)) {
boolean successfull; boolean successful = FileUtils.removeGpxFile(app, info.file);
successfull = removeAllFiles(info.file);
app.getGpxDbHelper().remove(info.file);
total++; total++;
if (successfull) { if (successful) {
count++; count++;
publishProgress(info); publishProgress(info);
} }
} }
} }
return app.getString(R.string.local_index_items_deleted, count, total); return getString(R.string.local_index_items_deleted, count, total);
} }
@Override @Override

View file

@ -866,7 +866,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
R.string.shared_string_ok, new DialogInterface.OnClickListener() { R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (FileUtils.removeGpxFile(app, new File((gpxFile.path)))) { if (FileUtils.removeGpxFile(app, new File(gpxFile.path))) {
dismiss(); dismiss();
} }
} }