fix screen refresh after unit change

This commit is contained in:
Milos Kozak 2021-11-06 22:56:34 +01:00
parent f9d24a0153
commit 175f008d3b

View file

@ -44,7 +44,6 @@ class OverviewPlugin @Inject constructor(
rh: ResourceHelper, rh: ResourceHelper,
private val config: Config, private val config: Config,
private val dateUtil: DateUtil, private val dateUtil: DateUtil,
private val profileFunction: ProfileFunction,
private val iobCobCalculator: IobCobCalculator, private val iobCobCalculator: IobCobCalculator,
private val repository: AppRepository, private val repository: AppRepository,
private val overviewData: OverviewData, private val overviewData: OverviewData,
@ -154,6 +153,18 @@ class OverviewPlugin @Inject constructor(
.subscribe({ .subscribe({
overviewData.pumpStatus = it.getStatus(rh) overviewData.pumpStatus = it.getStatus(rh)
}, fabricPrivacy::logException) }, fabricPrivacy::logException)
disposable += rxBus
.toObservable(EventPreferenceChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ event ->
if (event.isChanged(rh, R.string.key_units)) {
overviewData.reset()
overviewData.prepareBucketedData("EventBucketedDataCreated")
overviewData.prepareBgData("EventBucketedDataCreated")
overviewBus.send(EventUpdateOverview("EventBucketedDataCreated", OverviewData.Property.GRAPH))
loadAll("EventPreferenceChange")
}
}, fabricPrivacy::logException)
Thread { loadAll("onResume") }.start() Thread { loadAll("onResume") }.start()
} }