another solution to issue fix

This commit is contained in:
madwasp79 2019-05-06 11:31:30 +03:00
parent caa2c08454
commit 6dfc75fd28
3 changed files with 10 additions and 13 deletions

View file

@ -69,12 +69,6 @@ public class GpxSelectionHelper {
saveCurrentSelections();
}
public void clearAllGpxFilesWithoutBackup() {
selectedGpxFilesBackUp.clear();
selectedGPXFiles = new ArrayList<>();
saveCurrentSelections();
}
public void restoreSelectedGpxFiles() {
for (Entry<GPXFile, Long> gpxEntry : selectedGpxFilesBackUp.entrySet()) {
if (!Algorithms.isEmpty(gpxEntry.getKey().path)) {

View file

@ -161,15 +161,18 @@ public class ConfigureMapMenu {
for (GpxSelectionHelper.SelectedGpxFile file : selectedGpxFiles) {
files.add(file.getGpxFile().path);
}
Map<GPXUtilities.GPXFile, Long> fls = selectedGpxHelper.getSelectedGpxFilesBackUp();
for(Map.Entry<GPXUtilities.GPXFile, Long> f : fls.entrySet()) {
if(!Algorithms.isEmpty(f.getKey().path)) {
File file = new File(f.getKey().path);
if(file.exists() && !file.isDirectory()) {
files.add(f.getKey().path);
if (selectedGpxFiles.isEmpty()) {
Map<GPXUtilities.GPXFile, Long> fls = selectedGpxHelper.getSelectedGpxFilesBackUp();
for(Map.Entry<GPXUtilities.GPXFile, Long> f : fls.entrySet()) {
if(!Algorithms.isEmpty(f.getKey().path)) {
File file = new File(f.getKey().path);
if(file.exists() && !file.isDirectory()) {
files.add(f.getKey().path);
}
}
}
}
return files;
}

View file

@ -613,7 +613,7 @@ public class GpxUiHelper {
//clear all previously selected files before adding new one
OsmandApplication app = (OsmandApplication) activity.getApplication();
if (app != null && app.getSelectedGpxHelper() != null) {
app.getSelectedGpxHelper().clearAllGpxFilesWithoutBackup();
app.getSelectedGpxHelper().clearAllGpxFileToShow();
}
if (app != null && showCurrentGpx && adapter.getItem(0).getSelected()) {
currentGPX = app.getSavingTrackHelper().getCurrentGpx();