diff --git a/implementation/src/main/java/info/nightscout/implementation/overview/OverviewDataImpl.kt b/implementation/src/main/java/info/nightscout/implementation/overview/OverviewDataImpl.kt index c7bf701bcd..8d72168eff 100644 --- a/implementation/src/main/java/info/nightscout/implementation/overview/OverviewDataImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/overview/OverviewDataImpl.kt @@ -64,6 +64,7 @@ class OverviewDataImpl @Inject constructor( pumpStatus = "" calcProgressPct = 100 bgReadingsArray = ArrayList() + maxBgValue = Double.MIN_VALUE bucketedGraphSeries = PointsWithLabelGraphSeries() bgReadingGraphSeries = PointsWithLabelGraphSeries() predictionsGraphSeries = PointsWithLabelGraphSeries() @@ -71,22 +72,36 @@ class OverviewDataImpl @Inject constructor( tempBasalGraphSeries = LineGraphSeries() basalLineGraphSeries = LineGraphSeries() absoluteBasalGraphSeries = LineGraphSeries() + temporaryTargetSeries = LineGraphSeries() + maxIAValue = 0.0 activitySeries = FixedLineGraphSeries() activityPredictionSeries = FixedLineGraphSeries() + maxIobValueFound = Double.MIN_VALUE iobSeries = FixedLineGraphSeries() absIobSeries = FixedLineGraphSeries() iobPredictions1Series = PointsWithLabelGraphSeries() //iobPredictions2Series = PointsWithLabelGraphSeries() + maxBGIValue = Double.MIN_VALUE minusBgiSeries = FixedLineGraphSeries() minusBgiHistSeries = FixedLineGraphSeries() + maxCobValueFound = Double.MIN_VALUE cobSeries = FixedLineGraphSeries() cobMinFailOverSeries = PointsWithLabelGraphSeries() + maxDevValueFound = Double.MIN_VALUE deviationsSeries = BarGraphSeries() + maxRatioValueFound = 5.0 //even if sens data equals 0 for all the period, minimum scale is between 95% and 105% + minRatioValueFound = -maxRatioValueFound ratioSeries = LineGraphSeries() + maxFromMaxValueFound = Double.MIN_VALUE + maxFromMinValueFound = Double.MIN_VALUE dsMaxSeries = LineGraphSeries() dsMinSeries = LineGraphSeries() + maxTreatmentsValue = 0.0 treatmentsSeries = PointsWithLabelGraphSeries() + maxEpsValue = 0.0 epsSeries = PointsWithLabelGraphSeries() + maxTherapyEventValue = 0.0 + therapyEventSeries = PointsWithLabelGraphSeries() heartRateGraphSeries = LineGraphSeries() } diff --git a/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/MaintenanceFragment.kt b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/MaintenanceFragment.kt index d54b79ee3d..73d5e51242 100644 --- a/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/MaintenanceFragment.kt +++ b/plugins/configuration/src/main/java/info/nightscout/configuration/maintenance/MaintenanceFragment.kt @@ -103,7 +103,10 @@ class MaintenanceFragment : DaggerFragment() { .subscribeOn(aapsSchedulers.io) .subscribeBy( onError = { aapsLogger.error("Error clearing databases", it) }, - onComplete = { rxBus.send(EventPreferenceChange(rh.gs(info.nightscout.core.utils.R.string.key_units))) } + onComplete = { + rxBus.send(EventPreferenceChange(rh.gs(info.nightscout.core.utils.R.string.key_units))) + activity.recreate() + } ) uel.log(Action.RESET_DATABASES, Sources.Maintenance) }) diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewPlugin.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewPlugin.kt index 9d1c215d9e..6b514eb010 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewPlugin.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewPlugin.kt @@ -30,6 +30,7 @@ import info.nightscout.plugins.general.overview.notifications.events.EventUpdate import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventDismissNotification +import info.nightscout.rx.events.EventNewHistoryData import info.nightscout.rx.events.EventPumpStatusChanged import info.nightscout.rx.events.EventUpdateOverviewCalcProgress import info.nightscout.rx.logging.AAPSLogger @@ -187,6 +188,7 @@ class OverviewPlugin @Inject constructor( .putInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, sp, rh) override fun applyConfiguration(configuration: JSONObject) { + val previousUnits = sp.getString(info.nightscout.core.utils.R.string.key_units, "random") configuration .storeString(info.nightscout.core.utils.R.string.key_units, sp, rh) .storeString(info.nightscout.core.utils.R.string.key_quickwizard, sp, rh) @@ -213,5 +215,10 @@ class OverviewPlugin @Inject constructor( .storeDouble(R.string.key_statuslights_bat_warning, sp, rh) .storeDouble(R.string.key_statuslights_bat_critical, sp, rh) .storeInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, sp, rh) + val newUnits = sp.getString(info.nightscout.core.utils.R.string.key_units, "new") + if (previousUnits != newUnits) { + overviewData.reset() + rxBus.send(EventNewHistoryData(0L, reloadBgData = true)) + } } }