fix reliable indication of recording in recording widget

This commit is contained in:
sonora 2014-08-24 10:54:15 +02:00
parent 346c58b880
commit ac8c67adfa
2 changed files with 20 additions and 13 deletions

View file

@ -58,6 +58,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
private LatLon lastPoint;
private float distance = 0;
private boolean record = false;
private SelectedGpxFile currentTrack;
public SavingTrackHelper(OsmandApplication ctx){
@ -312,7 +313,7 @@ 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();
boolean record = false;
//boolean record = false;
if(OsmAndLocationProvider.isPointAccurateForRouting(location) &&
OsmAndLocationProvider.isNotSimulatedLocation(location) ) {
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
@ -391,6 +392,10 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
}
}
public boolean getRecord() {
return record;
}
public float getDistance() {
return distance;
}

View file

@ -170,8 +170,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
Drawable d = monitoringInactive;
long last = lastUpdateTime;
final boolean globalRecord = settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
//if (globalRecord || settings.SAVE_TRACK_TO_GPX.get()) {
float dist = app.getSavingTrackHelper().getDistance();
final boolean record = app.getSavingTrackHelper().getRecord();
float dist = app.getSavingTrackHelper().getDistance();
//make sure widget always shows recorded track distance if unsaved track exists
if (dist > 0) {
last = app.getSavingTrackHelper().getLastTimeUpdated();
@ -184,16 +185,17 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
subtxt = ds.substring(ls + 1);
}
}
if(globalRecord) {
//indicates global recording (+background recording)
d = monitoringBig;
} else if (settings.SAVE_TRACK_TO_GPX.get()) {
//indicates (profile-based, configured in settings) screen-on recording
d = monitoringSmall;
} else {
d = monitoringInactive;
}
//}
if(globalRecord) {
//indicates global recording (+background recording)
d = monitoringBig;
} else if (record) {
//indicates (profile-based, configured in settings) recording (looks like is only active during nav in follow mode)
d = monitoringSmall;
} else {
d = monitoringInactive;
}
setText(txt, subtxt);
setImageDrawable(d);
if (last != lastUpdateTime && globalRecord) {