From 329ccd2560917ba0f29a9f793c1741a4ccbb12e2 Mon Sep 17 00:00:00 2001 From: sonora Date: Mon, 18 May 2020 23:21:48 +0200 Subject: [PATCH 1/4] 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)); From 42f772ae7be74a6001f5e1dee99d35b39d130201 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Tue, 19 May 2020 17:51:56 +0200 Subject: [PATCH 2/4] Update strings.xml --- OsmAnd/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 010e63866b..190461e9ee 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. - Stop and save current track + Save current track Auto-record track during navigation A GPX track is automatically saved to the tracks folder during navigation. Logging interval From 515198443d0b902ab7ca8028c30489e96753c283 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Tue, 19 May 2020 17:53:26 +0200 Subject: [PATCH 3/4] Update OsmandMonitoringPlugin.java --- .../src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 4809a318ea..8656c01019 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -392,8 +392,6 @@ 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; From a450e02a77eb9be3ef0f245b3cf1df161a56ea46 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Tue, 19 May 2020 17:54:11 +0200 Subject: [PATCH 4/4] Update GpxNotification.java --- OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java b/OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java index e853785459..b84640bcfe 100644 --- a/OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java +++ b/OsmAnd/src/net/osmand/plus/notifications/GpxNotification.java @@ -44,10 +44,6 @@ public class GpxNotification extends OsmandNotification { final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class); if (plugin != null) { plugin.saveCurrentTrack(); - // #8911: Include stopRecording in saveCurrentTrack - //if (!app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()) { - // plugin.stopRecording(); - //} } } }, new IntentFilter(OSMAND_SAVE_GPX_SERVICE_ACTION));