diff --git a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt index f2ecdbfac9..66be4af5c9 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt @@ -242,7 +242,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { .observeOn(aapsSchedulers.main) .subscribe({ if (it.cause is EventCustomCalculationFinished) - binding.overviewIobcalculationprogess.text = it.progress + binding.overviewIobcalculationprogess.text = it.progressPct.toString() + "%" }, fabricPrivacy::logException) disposable += rxBus .toObservable(EventRefreshOverview::class.java) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt index b64d30970b..982a662d4a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt @@ -63,7 +63,7 @@ class OverviewData @Inject constructor( fun reset() { pumpStatus = "" - calcProgress = "" + calcProgressPct = 100 lastBg = null bolusIob = null basalIob = null @@ -121,7 +121,7 @@ class OverviewData @Inject constructor( * CALC PROGRESS */ - var calcProgress: String = "" + var calcProgressPct: Int = 100 /* * BG 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 d03f1ab4c3..28cf943774 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 @@ -1029,7 +1029,8 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList @Suppress("UNUSED_PARAMETER") fun updateCalcProgress(from: String) { - binding.graphsLayout.iobCalculationProgress.text = overviewData.calcProgress + binding.progressBar.progress = overviewData.calcProgressPct + binding.progressBar.visibility = (overviewData.calcProgressPct != 100).toVisibility() } @Suppress("UNUSED_PARAMETER") diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt index 8685abdbe3..3823bb5147 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt @@ -89,7 +89,7 @@ class OverviewPlugin @Inject constructor( disposable += rxBus .toObservable(EventIobCalculationProgress::class.java) .observeOn(aapsSchedulers.io) - .subscribe({ overviewData.calcProgress = it.progress; overviewBus.send(EventUpdateOverviewCalcProgress("EventIobCalculationProgress")) }, fabricPrivacy::logException) + .subscribe({ overviewData.calcProgressPct = it.progressPct; overviewBus.send(EventUpdateOverviewCalcProgress("EventIobCalculationProgress")) }, fabricPrivacy::logException) disposable += rxBus .toObservable(EventTempBasalChange::class.java) .observeOn(aapsSchedulers.io) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt index 7b47278a8e..446f836576 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt @@ -109,7 +109,7 @@ class IobCobOref1Worker( // start from oldest to be able sub cob for (i in bucketedData.size - 4 downTo 0) { val progress = i.toString() + if (buildHelper.isDev()) " (${data.from})" else "" - rxBus.send(EventIobCalculationProgress(progress, data.cause)) + rxBus.send(EventIobCalculationProgress(100 - (100.0 * i / bucketedData.size).toInt(), data.cause)) if (isStopped) { aapsLogger.debug(LTag.AUTOSENS, "Aborting calculation thread (trigger): ${data.from}") return Result.failure(workDataOf("Error" to "Aborting calculation thread (trigger): ${data.from}")) @@ -338,7 +338,7 @@ class IobCobOref1Worker( rxBus.send(EventAutosensCalculationFinished(data.cause)) }.start() } finally { - rxBus.send(EventIobCalculationProgress("", data.cause)) + rxBus.send(EventIobCalculationProgress(100, data.cause)) aapsLogger.debug(LTag.AUTOSENS, "AUTOSENSDATA thread ended: ${data.from}") profiler.log(LTag.AUTOSENS, "IobCobOref1Thread", start) } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOrefWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOrefWorker.kt index 879c8c9680..4bda1f1821 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOrefWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOrefWorker.kt @@ -105,7 +105,7 @@ class IobCobOrefWorker @Inject internal constructor( // start from oldest to be able sub cob for (i in bucketedData.size - 4 downTo 0) { val progress = i.toString() + if (buildHelper.isDev()) " (${data.from})" else "" - rxBus.send(EventIobCalculationProgress(progress, data.cause)) + rxBus.send(EventIobCalculationProgress(100 - (100.0 * i / bucketedData.size).toInt(), data.cause)) if (isStopped) { aapsLogger.debug(LTag.AUTOSENS, "Aborting calculation thread (trigger): ${data.from}") return Result.failure(workDataOf("Error" to "Aborting calculation thread (trigger): ${data.from}")) @@ -282,7 +282,7 @@ class IobCobOrefWorker @Inject internal constructor( rxBus.send(EventAutosensCalculationFinished(data.cause)) }.start() } finally { - rxBus.send(EventIobCalculationProgress("", data.cause)) + rxBus.send(EventIobCalculationProgress(100, data.cause)) aapsLogger.debug(LTag.AUTOSENS, "AUTOSENSDATA thread ended: ${data.from}") profiler.log(LTag.AUTOSENS, "IobCobThread", start) } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/events/EventIobCalculationProgress.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/events/EventIobCalculationProgress.kt index a5326e4ad3..e326b3c750 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/events/EventIobCalculationProgress.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/events/EventIobCalculationProgress.kt @@ -2,4 +2,4 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator.events import info.nightscout.androidaps.events.Event -class EventIobCalculationProgress(val progress: String, val cause: Event?) : Event() \ No newline at end of file +class EventIobCalculationProgress(val progressPct: Int, val cause: Event?) : Event() \ No newline at end of file diff --git a/app/src/main/res/layout/overview_fragment.xml b/app/src/main/res/layout/overview_fragment.xml index d39ac7a4ea..7f059cc5ca 100644 --- a/app/src/main/res/layout/overview_fragment.xml +++ b/app/src/main/res/layout/overview_fragment.xml @@ -144,6 +144,17 @@ + + diff --git a/app/src/main/res/layout/overview_graphs_layout.xml b/app/src/main/res/layout/overview_graphs_layout.xml index 7fdb20f6d9..dd35dc7684 100644 --- a/app/src/main/res/layout/overview_graphs_layout.xml +++ b/app/src/main/res/layout/overview_graphs_layout.xml @@ -15,7 +15,7 @@ android:id="@+id/bg_graph" android:layout_width="wrap_content" android:layout_height="200dp" - android:contentDescription="@string/a11y_graph"/> + android:contentDescription="@string/a11y_graph" /> - -