Merge pull request #7025 from osmandapp/gpx_selection_fix

gpx selection fix
This commit is contained in:
vshcherb 2019-06-10 12:04:40 +02:00 committed by GitHub
commit 743efb2a1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 6 deletions

View file

@ -60,10 +60,12 @@ public class GpxSelectionHelper {
savingTrackHelper = trackHelper;
}
public void clearAllGpxFileToShow() {
public void clearAllGpxFileToShow(boolean backupSelection) {
selectedGpxFilesBackUp.clear();
for(SelectedGpxFile s : selectedGPXFiles) {
selectedGpxFilesBackUp.put(s.gpxFile, s.modifiedTime);
if (backupSelection) {
for(SelectedGpxFile s : selectedGPXFiles) {
selectedGpxFilesBackUp.put(s.gpxFile, s.modifiedTime);
}
}
selectedGPXFiles = new ArrayList<>();
saveCurrentSelections();

View file

@ -219,7 +219,7 @@ public class ConfigureMapMenu {
} else if (itemId == R.string.layer_gpx_layer) {
final GpxSelectionHelper selectedGpxHelper = ma.getMyApplication().getSelectedGpxHelper();
if (selectedGpxHelper.isShowingAnyGpxFiles()) {
selectedGpxHelper.clearAllGpxFileToShow();
selectedGpxHelper.clearAllGpxFileToShow(true);
adapter.getItem(pos).setDescription(selectedGpxHelper.getGpxDescription());
} else {
showGpxSelectionDialog(adapter, adapter.getItem(pos));

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().clearAllGpxFileToShow();
app.getSelectedGpxHelper().clearAllGpxFileToShow(false);
}
if (app != null && showCurrentGpx && adapter.getItem(0).getSelected()) {
currentGPX = app.getSavingTrackHelper().getCurrentGpx();

View file

@ -36,7 +36,7 @@ public class ShowHideGpxTracksAction extends QuickAction {
final GpxSelectionHelper selectedGpxHelper = activity.getMyApplication()
.getSelectedGpxHelper();
if (selectedGpxHelper.isShowingAnyGpxFiles()) {
selectedGpxHelper.clearAllGpxFileToShow();
selectedGpxHelper.clearAllGpxFileToShow(true);
} else {
selectedGpxHelper.restoreSelectedGpxFiles();
}