Extend track auto-record during navigation
This commit is contained in:
parent
81fb35936a
commit
fc1883cf3c
1 changed files with 10 additions and 3 deletions
|
@ -19,6 +19,7 @@ import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
|||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
|
@ -79,6 +80,8 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
private int points;
|
||||
private int trkPoints = 0;
|
||||
|
||||
private ApplicationMode lastRoutingApplicationMode;
|
||||
|
||||
public SavingTrackHelper(OsmandApplication ctx) {
|
||||
super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
this.ctx = ctx;
|
||||
|
@ -440,12 +443,15 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
} else {
|
||||
heading = NO_HEADING;
|
||||
}
|
||||
if (ctx.getRoutingHelper().isFollowingMode()) {
|
||||
lastRoutingApplicationMode = settings.getApplicationMode();
|
||||
}
|
||||
boolean record = false;
|
||||
if (location != null && OsmAndLocationProvider.isNotSimulatedLocation(location)
|
||||
&& OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
|
||||
if (settings.SAVE_TRACK_TO_GPX.get()
|
||||
&& locationTime - lastTimeUpdated > settings.SAVE_TRACK_INTERVAL.get()
|
||||
&& ctx.getRoutingHelper().isFollowingMode()) {
|
||||
&& (ctx.getRoutingHelper().isFollowingMode() || lastRoutingApplicationMode == settings.getApplicationMode())) {
|
||||
record = true;
|
||||
} else if (settings.SAVE_GLOBAL_TRACK_TO_GPX.get()
|
||||
&& locationTime - lastTimeUpdated > settings.SAVE_GLOBAL_TRACK_INTERVAL.get()) {
|
||||
|
@ -705,9 +711,10 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
|
||||
public boolean getIsRecording() {
|
||||
OsmandSettings settings = ctx.getSettings();
|
||||
return OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null
|
||||
&& ctx.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()
|
||||
|| (ctx.getSettings().SAVE_TRACK_TO_GPX.get() && ctx.getRoutingHelper().isFollowingMode());
|
||||
&& settings.SAVE_GLOBAL_TRACK_TO_GPX.get() || settings.SAVE_TRACK_TO_GPX.get()
|
||||
&& (ctx.getRoutingHelper().isFollowingMode() || lastRoutingApplicationMode == settings.getApplicationMode());
|
||||
}
|
||||
|
||||
public float getDistance() {
|
||||
|
|
Loading…
Reference in a new issue