From 329ccd2560917ba0f29a9f793c1741a4ccbb12e2 Mon Sep 17 00:00:00 2001 From: sonora Date: Mon, 18 May 2020 23:21:48 +0200 Subject: [PATCH] Combine Save GPX with Stop action --- OsmAnd/res/values/strings.xml | 2 +- .../net/osmand/plus/monitoring/OsmandMonitoringPlugin.java | 3 +++ .../src/net/osmand/plus/notifications/GpxNotification.java | 7 ++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 190461e9ee..010e63866b 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -2071,7 +2071,7 @@ On demand track logging General position logging to a GPX file can be turned on or off using the GPX logging widget on the map. Save current track as GPX file now. - Save current track + Stop and save current track Auto-record track during navigation A GPX track is automatically saved to the tracks folder during navigation. Logging interval diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 2a81894017..4809a318ea 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -393,6 +393,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { public void saveCurrentTrack(@Nullable final Runnable onComplete, @Nullable Activity activity) { + // #8911: Include stopRecording in saveCurrentTrack + stopRecording(); + final WeakReference activityRef = activity != null ? new WeakReference<>(activity) : null; app.getTaskManager().runInBackground(new OsmAndTaskRunnable() { diff --git a/OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java b/OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java index dfb955c610..e853785459 100644 --- a/OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java +++ b/OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java @@ -44,9 +44,10 @@ public class GpxNotification extends OsmandNotification { final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class); if (plugin != null) { plugin.saveCurrentTrack(); - if (!app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()) { - plugin.stopRecording(); - } + // #8911: Include stopRecording in saveCurrentTrack + //if (!app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()) { + // plugin.stopRecording(); + //} } } }, new IntentFilter(OSMAND_SAVE_GPX_SERVICE_ACTION));