Display when Target BG is overidden
This commit is contained in:
parent
a20008c0db
commit
77a5af75e2
1 changed files with 22 additions and 4 deletions
|
@ -646,6 +646,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
} else {
|
} else {
|
||||||
overview_apsmode_text?.visibility = View.GONE
|
overview_apsmode_text?.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
val lastRun = loopPlugin.lastRun
|
||||||
|
|
||||||
// temp target
|
// temp target
|
||||||
val tempTarget = treatmentsPlugin.tempTargetFromHistory
|
val tempTarget = treatmentsPlugin.tempTargetFromHistory
|
||||||
|
@ -654,10 +655,28 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
overview_temptarget?.setBackgroundColor(resourceHelper.gc(R.color.ribbonWarning))
|
overview_temptarget?.setBackgroundColor(resourceHelper.gc(R.color.ribbonWarning))
|
||||||
overview_temptarget?.text = Profile.toTargetRangeString(tempTarget.low, tempTarget.high, Constants.MGDL, units) + " " + DateUtil.untilString(tempTarget.end(), resourceHelper)
|
overview_temptarget?.text = Profile.toTargetRangeString(tempTarget.low, tempTarget.high, Constants.MGDL, units) + " " + DateUtil.untilString(tempTarget.end(), resourceHelper)
|
||||||
} else {
|
} else {
|
||||||
|
//If the target is not the same as set in the profile then oref has overridden it
|
||||||
|
//show this change to the user if it exists
|
||||||
|
if (lastRun != null){
|
||||||
|
var targetused = lastRun!!.constraintsProcessed!!.targetBG
|
||||||
|
if (units == Constants.MMOL)
|
||||||
|
targetused *= Constants.MGDL_TO_MMOLL
|
||||||
|
|
||||||
|
if (profile.targetUnits != targetused) {
|
||||||
|
overview_temptarget?.text = targetused.toString()
|
||||||
|
overview_temptarget?.setTextColor(resourceHelper.gc(R.color.ribbonTextWarning))
|
||||||
|
overview_temptarget?.setBackgroundColor(resourceHelper.gc(R.color.tempTargetBackground))
|
||||||
|
}else{
|
||||||
overview_temptarget?.setTextColor(resourceHelper.gc(R.color.ribbonTextDefault))
|
overview_temptarget?.setTextColor(resourceHelper.gc(R.color.ribbonTextDefault))
|
||||||
overview_temptarget?.setBackgroundColor(resourceHelper.gc(R.color.ribbonDefault))
|
overview_temptarget?.setBackgroundColor(resourceHelper.gc(R.color.ribbonDefault))
|
||||||
overview_temptarget?.text = Profile.toTargetRangeString(profile.targetLowMgdl, profile.targetHighMgdl, Constants.MGDL, units)
|
overview_temptarget?.text = Profile.toTargetRangeString(profile.targetLowMgdl, profile.targetHighMgdl, Constants.MGDL, units)
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
overview_temptarget?.setTextColor(resourceHelper.gc(R.color.ribbonTextDefault))
|
||||||
|
overview_temptarget?.setBackgroundColor(resourceHelper.gc(R.color.ribbonDefault))
|
||||||
|
overview_temptarget?.text = Profile.toTargetRangeString(profile.targetLowMgdl, profile.targetHighMgdl, Constants.MGDL, units)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Basal, TBR
|
// Basal, TBR
|
||||||
val activeTemp = treatmentsPlugin.getTempBasalFromHistory(System.currentTimeMillis())
|
val activeTemp = treatmentsPlugin.getTempBasalFromHistory(System.currentTimeMillis())
|
||||||
|
@ -741,7 +760,6 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
}
|
}
|
||||||
overview_cob?.text = cobText
|
overview_cob?.text = cobText
|
||||||
|
|
||||||
val lastRun = loopPlugin.lastRun
|
|
||||||
val predictionsAvailable = if (config.APS) lastRun?.request?.hasPredictions == true else config.NSCLIENT
|
val predictionsAvailable = if (config.APS) lastRun?.request?.hasPredictions == true else config.NSCLIENT
|
||||||
|
|
||||||
// pump status from ns
|
// pump status from ns
|
||||||
|
|
Loading…
Reference in a new issue