added staledataalarm
This commit is contained in:
parent
541a261dda
commit
74bb05a654
1 changed files with 17 additions and 2 deletions
|
@ -111,9 +111,9 @@ public class Notification {
|
||||||
return true;
|
return true;
|
||||||
if (level == ANNOUNCEMENT)
|
if (level == ANNOUNCEMENT)
|
||||||
return true;
|
return true;
|
||||||
if (level == NORMAL && isAlarmForLow() && SP.getBoolean(R.string.key_nsalarm_low, false) || isAlarmForHigh() && SP.getBoolean(R.string.key_nsalarm_high, false))
|
if (level == NORMAL && isAlarmForLow() && SP.getBoolean(R.string.key_nsalarm_low, false) || isAlarmForHigh() && SP.getBoolean(R.string.key_nsalarm_high, false) || isAlarmForStaleData() && SP.getBoolean(R.string.key_nsalarm_staledata, false))
|
||||||
return true;
|
return true;
|
||||||
if (level == URGENT && isAlarmForLow() && SP.getBoolean(R.string.key_nsalarm_urgent_low, false) || isAlarmForHigh() && SP.getBoolean(R.string.key_nsalarm_urgent_high, false))
|
if (level == URGENT && isAlarmForLow() && SP.getBoolean(R.string.key_nsalarm_urgent_low, false) || isAlarmForHigh() && SP.getBoolean(R.string.key_nsalarm_urgent_high, false) || isAlarmForStaleData() && SP.getBoolean(R.string.key_nsalarm_urgent_staledata, false))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -141,4 +141,19 @@ public class Notification {
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isAlarmForStaleData(){
|
||||||
|
BgReading bgReading = MainApp.getDbHelper().lastBg();
|
||||||
|
if (bgReading == null)
|
||||||
|
return false;
|
||||||
|
long bgReadingAgo = System.currentTimeMillis() - bgReading.date;
|
||||||
|
int bgReadingAgoMin = (int) (bgReadingAgo / (1000 * 60));
|
||||||
|
//Integer staleDataThreshold = NSSettingsStatus.getInstance().getIntegerOrNull("alarmTimeagoWarnMins");
|
||||||
|
//if (staleDataThreshold == null)
|
||||||
|
// return false;
|
||||||
|
if(bgReadingAgoMin > SP.getInt(R.string.key_nsalarm_staledatavalue,16)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue