Add icons for live monitoring

This commit is contained in:
PavelRatushny 2017-10-11 13:49:25 +03:00
parent 18db340d6b
commit dc4107d809

View file

@ -156,8 +156,8 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
} }
String txt = map.getString(R.string.monitoring_control_start); String txt = map.getString(R.string.monitoring_control_start);
String subtxt = null; String subtxt = null;
int dn = R.drawable.widget_monitoring_rec_inactive_night; int dn;
int d = R.drawable.widget_monitoring_rec_inactive_day; int d;
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();
final boolean isRecording = app.getSavingTrackHelper().getIsRecording(); final boolean isRecording = app.getSavingTrackHelper().getIsRecording();
@ -176,14 +176,25 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
} }
} }
final boolean liveMonitoringEnabled = liveMonitoringHelper.isLiveMonitoringEnabled();
if(globalRecord) { if(globalRecord) {
//indicates global recording (+background recording) //indicates global recording (+background recording)
if (liveMonitoringEnabled) {
dn = R.drawable.widget_live_monitoring_rec_big_night;
d = R.drawable.widget_live_monitoring_rec_big_day;
} else {
dn = R.drawable.widget_monitoring_rec_big_night; dn = R.drawable.widget_monitoring_rec_big_night;
d = R.drawable.widget_monitoring_rec_big_day; d = R.drawable.widget_monitoring_rec_big_day;
}
} else if (isRecording) { } else if (isRecording) {
//indicates (profile-based, configured in settings) recording (looks like is only active during nav in follow mode) //indicates (profile-based, configured in settings) recording (looks like is only active during nav in follow mode)
if (liveMonitoringEnabled) {
dn = R.drawable.widget_live_monitoring_rec_small_night;
d = R.drawable.widget_live_monitoring_rec_small_day;
} else {
dn = R.drawable.widget_monitoring_rec_small_night; dn = R.drawable.widget_monitoring_rec_small_night;
d = R.drawable.widget_monitoring_rec_small_day; d = R.drawable.widget_monitoring_rec_small_day;
}
} else { } else {
dn = R.drawable.widget_monitoring_rec_inactive_night; dn = R.drawable.widget_monitoring_rec_inactive_night;
d = R.drawable.widget_monitoring_rec_inactive_day; d = R.drawable.widget_monitoring_rec_inactive_day;
@ -194,24 +205,38 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
if ((last != lastUpdateTime) && (globalRecord || isRecording)) { if ((last != lastUpdateTime) && (globalRecord || isRecording)) {
lastUpdateTime = last; lastUpdateTime = last;
//blink implementation with 2 indicator states (global logging + profile/navigation logging) //blink implementation with 2 indicator states (global logging + profile/navigation logging)
if (globalRecord) { if (liveMonitoringEnabled) {
setIcons(R.drawable.widget_monitoring_rec_small_day, dn = R.drawable.widget_live_monitoring_rec_small_night;
R.drawable.widget_monitoring_rec_small_night); d = R.drawable.widget_live_monitoring_rec_small_day;
} else { } else {
setIcons(R.drawable.widget_monitoring_rec_small_day, dn = R.drawable.widget_monitoring_rec_small_night;
R.drawable.widget_monitoring_rec_small_night); d = R.drawable.widget_monitoring_rec_small_day;
} }
setIcons(d, dn);
map.getMyApplication().runInUIThread(new Runnable() { map.getMyApplication().runInUIThread(new Runnable() {
@Override @Override
public void run() { public void run() {
int dn;
int d;
if (globalRecord) { if (globalRecord) {
setIcons(R.drawable.widget_monitoring_rec_big_day, if (liveMonitoringEnabled) {
R.drawable.widget_monitoring_rec_big_night); dn = R.drawable.widget_live_monitoring_rec_big_night;
d = R.drawable.widget_live_monitoring_rec_big_day;
} else { } else {
setIcons(R.drawable.widget_monitoring_rec_small_day, dn = R.drawable.widget_monitoring_rec_big_night;
R.drawable.widget_monitoring_rec_small_night); d = R.drawable.widget_monitoring_rec_big_day;
} }
} else {
if (liveMonitoringEnabled) {
dn = R.drawable.widget_live_monitoring_rec_small_night;
d = R.drawable.widget_live_monitoring_rec_small_day;
} else {
dn = R.drawable.widget_monitoring_rec_small_night;
d = R.drawable.widget_monitoring_rec_small_day;
}
}
setIcons(d, dn);
} }
}, 500); }, 500);
} }