From 33f3949030c274ef7b993117d2e90c41e543b7e2 Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Mon, 10 Jun 2019 12:29:38 +0300 Subject: [PATCH] gpx selection fix --- OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java | 8 +++++--- OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java | 2 +- OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java | 2 +- .../plus/quickaction/actions/ShowHideGpxTracksAction.java | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java index 36af56140b..cea4eaa726 100644 --- a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java +++ b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java @@ -60,10 +60,12 @@ public class GpxSelectionHelper { savingTrackHelper = trackHelper; } - public void clearAllGpxFileToShow() { + public void clearAllGpxFileToShow(boolean switchSelection) { selectedGpxFilesBackUp.clear(); - for(SelectedGpxFile s : selectedGPXFiles) { - selectedGpxFilesBackUp.put(s.gpxFile, s.modifiedTime); + if (switchSelection) { + for(SelectedGpxFile s : selectedGPXFiles) { + selectedGpxFilesBackUp.put(s.gpxFile, s.modifiedTime); + } } selectedGPXFiles = new ArrayList<>(); saveCurrentSelections(); diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index 6be252d98d..05089508f0 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -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)); diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index c3f5976c4a..78111c3260 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -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(); diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/ShowHideGpxTracksAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/ShowHideGpxTracksAction.java index a37d883b52..b460f3163d 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/ShowHideGpxTracksAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/ShowHideGpxTracksAction.java @@ -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(); }