fix reliable indication of recording in recording widget
This commit is contained in:
parent
346c58b880
commit
ac8c67adfa
2 changed files with 20 additions and 13 deletions
|
@ -58,6 +58,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
private LatLon lastPoint;
|
private LatLon lastPoint;
|
||||||
private float distance = 0;
|
private float distance = 0;
|
||||||
|
private boolean record = false;
|
||||||
private SelectedGpxFile currentTrack;
|
private SelectedGpxFile currentTrack;
|
||||||
|
|
||||||
public SavingTrackHelper(OsmandApplication ctx){
|
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()
|
// use because there is a bug on some devices with location.getTime()
|
||||||
long locationTime = System.currentTimeMillis();
|
long locationTime = System.currentTimeMillis();
|
||||||
OsmandSettings settings = ctx.getSettings();
|
OsmandSettings settings = ctx.getSettings();
|
||||||
boolean record = false;
|
//boolean record = false;
|
||||||
if(OsmAndLocationProvider.isPointAccurateForRouting(location) &&
|
if(OsmAndLocationProvider.isPointAccurateForRouting(location) &&
|
||||||
OsmAndLocationProvider.isNotSimulatedLocation(location) ) {
|
OsmAndLocationProvider.isNotSimulatedLocation(location) ) {
|
||||||
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
|
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
|
||||||
|
@ -391,6 +392,10 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getRecord() {
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
|
||||||
public float getDistance() {
|
public float getDistance() {
|
||||||
return distance;
|
return distance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,8 +170,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
||||||
Drawable d = monitoringInactive;
|
Drawable d = monitoringInactive;
|
||||||
long last = lastUpdateTime;
|
long last = lastUpdateTime;
|
||||||
final boolean globalRecord = settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
|
final boolean globalRecord = settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
|
||||||
//if (globalRecord || settings.SAVE_TRACK_TO_GPX.get()) {
|
final boolean record = app.getSavingTrackHelper().getRecord();
|
||||||
float dist = app.getSavingTrackHelper().getDistance();
|
float dist = app.getSavingTrackHelper().getDistance();
|
||||||
|
|
||||||
//make sure widget always shows recorded track distance if unsaved track exists
|
//make sure widget always shows recorded track distance if unsaved track exists
|
||||||
if (dist > 0) {
|
if (dist > 0) {
|
||||||
last = app.getSavingTrackHelper().getLastTimeUpdated();
|
last = app.getSavingTrackHelper().getLastTimeUpdated();
|
||||||
|
@ -184,16 +185,17 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
||||||
subtxt = ds.substring(ls + 1);
|
subtxt = ds.substring(ls + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(globalRecord) {
|
|
||||||
//indicates global recording (+background recording)
|
if(globalRecord) {
|
||||||
d = monitoringBig;
|
//indicates global recording (+background recording)
|
||||||
} else if (settings.SAVE_TRACK_TO_GPX.get()) {
|
d = monitoringBig;
|
||||||
//indicates (profile-based, configured in settings) screen-on recording
|
} else if (record) {
|
||||||
d = monitoringSmall;
|
//indicates (profile-based, configured in settings) recording (looks like is only active during nav in follow mode)
|
||||||
} else {
|
d = monitoringSmall;
|
||||||
d = monitoringInactive;
|
} else {
|
||||||
}
|
d = monitoringInactive;
|
||||||
//}
|
}
|
||||||
|
|
||||||
setText(txt, subtxt);
|
setText(txt, subtxt);
|
||||||
setImageDrawable(d);
|
setImageDrawable(d);
|
||||||
if (last != lastUpdateTime && globalRecord) {
|
if (last != lastUpdateTime && globalRecord) {
|
||||||
|
|
Loading…
Reference in a new issue