Display when Target BG is overidden

This commit is contained in:
Tim Gunn 2020-05-21 00:11:36 +12:00
parent a20008c0db
commit 77a5af75e2
No known key found for this signature in database
GPG key ID: C9BC1E9D0D0AED8C

View file

@ -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