fix widget behavior
This commit is contained in:
parent
f081c8eb1a
commit
89fba046d8
2 changed files with 17 additions and 6 deletions
|
@ -58,7 +58,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
|
||||
private LatLon lastPoint;
|
||||
private float distance = 0;
|
||||
private boolean record = false;
|
||||
private boolean isRecording = false;
|
||||
private SelectedGpxFile currentTrack;
|
||||
|
||||
public SavingTrackHelper(OsmandApplication ctx){
|
||||
|
@ -313,7 +313,8 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
// use because there is a bug on some devices with location.getTime()
|
||||
long locationTime = System.currentTimeMillis();
|
||||
OsmandSettings settings = ctx.getSettings();
|
||||
record = false;
|
||||
boolean record = false;
|
||||
isRecording = false;
|
||||
if(OsmAndLocationProvider.isPointAccurateForRouting(location) &&
|
||||
OsmAndLocationProvider.isNotSimulatedLocation(location) ) {
|
||||
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
|
||||
|
@ -328,6 +329,16 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
} else if(ctx.getAppCustomization().saveGPXPoint(location) && locationTime - lastTimeUpdated > settings.SAVE_GLOBAL_TRACK_INTERVAL.get()) {
|
||||
record = true;
|
||||
}
|
||||
|
||||
//check if recording is active for widget status light
|
||||
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
|
||||
if (settings.SAVE_GLOBAL_TRACK_TO_GPX.get() || (settings.SAVE_TRACK_TO_GPX.get() && ctx.getRoutingHelper().isFollowingMode()) {
|
||||
isRecording = true;
|
||||
}
|
||||
} else if (ctx.getAppCustomization().saveGPXPoint(location)) {
|
||||
isRecording = true;
|
||||
}
|
||||
|
||||
}
|
||||
if (record) {
|
||||
insertData(location.getLatitude(), location.getLongitude(), location.getAltitude(), location.getSpeed(),
|
||||
|
@ -392,8 +403,8 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean getRecord() {
|
||||
return record;
|
||||
public boolean getIsRecording() {
|
||||
return isRecording;
|
||||
}
|
||||
|
||||
public float getDistance() {
|
||||
|
|
|
@ -170,7 +170,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
|||
Drawable d = monitoringInactive;
|
||||
long last = lastUpdateTime;
|
||||
final boolean globalRecord = settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
|
||||
final boolean record = app.getSavingTrackHelper().getRecord();
|
||||
final boolean isRecording = app.getSavingTrackHelper().getIsRecording();
|
||||
float dist = app.getSavingTrackHelper().getDistance();
|
||||
|
||||
//make sure widget always shows recorded track distance if unsaved track exists
|
||||
|
@ -189,7 +189,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
|||
if(globalRecord) {
|
||||
//indicates global recording (+background recording)
|
||||
d = monitoringBig;
|
||||
} else if (record) {
|
||||
} else if (isRecording) {
|
||||
//indicates (profile-based, configured in settings) recording (looks like is only active during nav in follow mode)
|
||||
d = monitoringSmall;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue