Merge pull request #8478 from osmandapp/Fix_8406

Fix #8406
This commit is contained in:
max-klaus 2020-02-17 12:43:21 +03:00 committed by GitHub
commit 3111d3b93c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,6 +92,8 @@ public class ExternalApiHelper {
public static final String API_CMD_START_GPX_REC = "start_gpx_rec"; public static final String API_CMD_START_GPX_REC = "start_gpx_rec";
public static final String API_CMD_STOP_GPX_REC = "stop_gpx_rec"; public static final String API_CMD_STOP_GPX_REC = "stop_gpx_rec";
public static final String API_CMD_SAVE_GPX = "save_gpx";
public static final String API_CMD_CLEAR_GPX = "clear_gpx";
public static final String API_CMD_SUBSCRIBE_VOICE_NOTIFICATIONS = "subscribe_voice_notifications"; public static final String API_CMD_SUBSCRIBE_VOICE_NOTIFICATIONS = "subscribe_voice_notifications";
public static final int VERSION_CODE = 1; public static final int VERSION_CODE = 1;
@ -550,6 +552,30 @@ public class ExternalApiHelper {
plugin.stopRecording(); plugin.stopRecording();
} }
if (uri.getBooleanQueryParameter(PARAM_CLOSE_AFTER_COMMAND, true)) {
finish = true;
}
resultCode = Activity.RESULT_OK;
} else if (API_CMD_SAVE_GPX.equals(cmd)) {
OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
if (plugin == null) {
resultCode = RESULT_CODE_ERROR_PLUGIN_INACTIVE;
finish = true;
} else {
plugin.saveCurrentTrack();
}
if (uri.getBooleanQueryParameter(PARAM_CLOSE_AFTER_COMMAND, true)) {
finish = true;
}
resultCode = Activity.RESULT_OK;
} else if (API_CMD_CLEAR_GPX.equals(cmd)) {
OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
if (plugin == null) {
resultCode = RESULT_CODE_ERROR_PLUGIN_INACTIVE;
finish = true;
} else {
app.getSavingTrackHelper().clearRecordedData(true);
}
if (uri.getBooleanQueryParameter(PARAM_CLOSE_AFTER_COMMAND, true)) { if (uri.getBooleanQueryParameter(PARAM_CLOSE_AFTER_COMMAND, true)) {
finish = true; finish = true;
} }