diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt index ef97f95a3c..83a697e9f7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt @@ -233,17 +233,21 @@ class ActionsFragment : DaggerFragment() { actions_canceltempbasal?.visibility = View.GONE } } - + val activeBgSource = activePlugin.activeBgSource actions_historybrowser.visibility = (profile != null).toVisibility() actions_fill?.visibility = (pump.pumpDescription.isRefillingCapable && pump.isInitialized && !pump.isSuspended).toVisibility() actions_pumpbatterychange?.visibility = pump.pumpDescription.isBatteryReplaceable.toVisibility() actions_temptarget?.visibility = (profile != null && config.APS).toVisibility() actions_tddstats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility() if (!config.NSCLIENT) - statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, careportal_reservoirlevel, careportal_sensorage, careportal_pbage, careportal_batterylevel) + statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, careportal_reservoirlevel, careportal_sensorage, careportal_sensorlevel, careportal_pbage, careportal_batterylevel) else - statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, null, careportal_sensorage, careportal_pbage, null) + statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, null, careportal_sensorage, null, careportal_pbage, null) checkPumpCustomActions() + if (activeBgSource.sensorBatteryLevel == -1) + careportal_senslevellabel?.text = "" + else + careportal_senslevellabel?.text = resourceHelper.gs(R.string.careportal_level_label) } private fun checkPumpCustomActions() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index 1760ea45d0..0afab008c1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -741,7 +741,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList // Status lights overview_statuslights?.visibility = (sp.getBoolean(R.string.key_show_statuslights, true) || config.NSCLIENT).toVisibility() - statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, careportal_reservoirlevel, careportal_sensorage, careportal_pbage, careportal_batterylevel) + statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, careportal_reservoirlevel, careportal_sensorage, null, careportal_pbage, careportal_batterylevel) // cob var cobText: String = resourceHelper.gs(R.string.value_unavailable_short) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt index 8a95e34e1e..af361236fa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt @@ -27,14 +27,20 @@ class StatusLightHandler @Inject constructor( /** * applies the extended statusLight subview on the overview fragment */ - fun updateStatusLights(careportal_canulaage: TextView?, careportal_insulinage: TextView?, careportal_reservoirlevel: TextView?, careportal_sensorage: TextView?, careportal_pbage: TextView?, careportal_batterylevel: TextView?) { + fun updateStatusLights(careportal_canulaage: TextView?, careportal_insulinage: TextView?, careportal_reservoirlevel: TextView?, careportal_sensorage: TextView?, careportal_sensorbatterylevel: TextView?, careportal_pbage: TextView?, careportal_batterylevel: TextView?) { val pump = activePlugin.activePump + val bgSource = activePlugin.activeBgSource handleAge(careportal_canulaage, CareportalEvent.SITECHANGE, R.string.key_statuslights_cage_warning, 48.0, R.string.key_statuslights_cage_critical, 72.0) handleAge(careportal_insulinage, CareportalEvent.INSULINCHANGE, R.string.key_statuslights_iage_warning, 72.0, R.string.key_statuslights_iage_critical, 144.0) handleAge(careportal_sensorage, CareportalEvent.SENSORCHANGE, R.string.key_statuslights_sage_warning, 216.0, R.string.key_statuslights_sage_critical, 240.0) handleAge(careportal_pbage, CareportalEvent.PUMPBATTERYCHANGE, R.string.key_statuslights_bage_warning, 216.0, R.string.key_statuslights_bage_critical, 240.0) - if (!config.NSCLIENT) + if (!config.NSCLIENT) { handleLevel(careportal_reservoirlevel, R.string.key_statuslights_res_critical, 10.0, R.string.key_statuslights_res_warning, 80.0, pump.reservoirLevel, "U") + if (bgSource.sensorBatteryLevel != -1) + handleLevel(careportal_sensorbatterylevel, R.string.key_statuslights_sbat_critical, 5.0, R.string.key_statuslights_sbat_warning, 20.0, bgSource.sensorBatteryLevel.toDouble(), "%") + else + careportal_sensorbatterylevel?.text = "" + } if (!config.NSCLIENT && pump.model() != PumpType.AccuChekCombo) handleLevel(careportal_batterylevel, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%") } diff --git a/app/src/main/res/layout/careportal_stats_fragment2.xml b/app/src/main/res/layout/careportal_stats_fragment2.xml index ecc01aa416..0ea3d66f77 100644 --- a/app/src/main/res/layout/careportal_stats_fragment2.xml +++ b/app/src/main/res/layout/careportal_stats_fragment2.xml @@ -191,12 +191,12 @@ @@ -324,7 +324,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center_vertical" - android:paddingStart="5dp" + android:paddingStart="15dp" android:paddingRight="5dp" android:textSize="14sp" /> @@ -345,7 +345,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center_vertical" - android:paddingStart="5dp" + android:paddingStart="15dp" android:paddingRight="5dp" android:text="@string/careportal_level_label" android:textSize="14sp" /> @@ -363,7 +363,7 @@ + + + +