NSC: fix units update
This commit is contained in:
parent
a04076ac25
commit
60d3fb657a
3 changed files with 26 additions and 1 deletions
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue