Combine Save GPX with Stop action

This commit is contained in:
sonora 2020-05-18 23:21:48 +02:00
parent f71f606279
commit 329ccd2560
3 changed files with 8 additions and 4 deletions

View file

@ -2071,7 +2071,7 @@
<string name="save_track_to_gpx_globally_headline">On demand track logging</string> <string name="save_track_to_gpx_globally_headline">On demand track logging</string>
<string name="save_track_to_gpx_globally_descr">General position logging to a GPX file can be turned on or off using the GPX logging widget on the map.</string> <string name="save_track_to_gpx_globally_descr">General position logging to a GPX file can be turned on or off using the GPX logging widget on the map.</string>
<string name="save_current_track_descr">Save current track as GPX file now.</string> <string name="save_current_track_descr">Save current track as GPX file now.</string>
<string name="save_current_track">Save current track</string> <string name="save_current_track">Stop and save current track</string>
<string name="save_track_to_gpx">Auto-record track during navigation</string> <string name="save_track_to_gpx">Auto-record track during navigation</string>
<string name="save_track_to_gpx_descrp">A GPX track is automatically saved to the tracks folder during navigation.</string> <string name="save_track_to_gpx_descrp">A GPX track is automatically saved to the tracks folder during navigation.</string>
<string name="save_track_interval_globally">Logging interval</string> <string name="save_track_interval_globally">Logging interval</string>

View file

@ -393,6 +393,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
public void saveCurrentTrack(@Nullable final Runnable onComplete, @Nullable Activity activity) { public void saveCurrentTrack(@Nullable final Runnable onComplete, @Nullable Activity activity) {
// #8911: Include stopRecording in saveCurrentTrack
stopRecording();
final WeakReference<Activity> activityRef = activity != null ? new WeakReference<>(activity) : null; final WeakReference<Activity> activityRef = activity != null ? new WeakReference<>(activity) : null;
app.getTaskManager().runInBackground(new OsmAndTaskRunnable<Void, Void, SaveGpxResult>() { app.getTaskManager().runInBackground(new OsmAndTaskRunnable<Void, Void, SaveGpxResult>() {

View file

@ -44,9 +44,10 @@ public class GpxNotification extends OsmandNotification {
final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class); final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
if (plugin != null) { if (plugin != null) {
plugin.saveCurrentTrack(); plugin.saveCurrentTrack();
if (!app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()) { // #8911: Include stopRecording in saveCurrentTrack
plugin.stopRecording(); //if (!app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()) {
} // plugin.stopRecording();
//}
} }
} }
}, new IntentFilter(OSMAND_SAVE_GPX_SERVICE_ACTION)); }, new IntentFilter(OSMAND_SAVE_GPX_SERVICE_ACTION));