Dash Bolus delivered ptogress dialog

This commit is contained in:
Philoul 2022-07-26 22:31:52 +02:00
parent 0734b4c620
commit f9bebfccba
4 changed files with 7 additions and 5 deletions

View file

@ -25,6 +25,7 @@ android {
dependencies {
implementation project(':core')
implementation project(':shared')
implementation project(':pump-common')
api "androidx.room:room-ktx:$room_version"
api "androidx.room:room-runtime:$room_version"

View file

@ -590,7 +590,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
EventOverviewBolusProgress.Treatment t = new EventOverviewBolusProgress.Treatment(0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.getId());
final EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.INSTANCE;
bolusingEvent.setT(t);
bolusingEvent.setStatus(rh.gs(R.string.insight_delivered, 0d, insulin));
bolusingEvent.setStatus(rh.gs(R.string.bolus_delivered, 0d, insulin));
bolusingEvent.setPercent(0);
rxBus.send(bolusingEvent);
int trials = 0;
@ -629,14 +629,14 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
trials = -1;
int percentBefore = bolusingEvent.getPercent();
bolusingEvent.setPercent((int) (100D / activeBolus.getInitialAmount() * (activeBolus.getInitialAmount() - activeBolus.getRemainingAmount())));
bolusingEvent.setStatus(rh.gs(R.string.insight_delivered, activeBolus.getInitialAmount() - activeBolus.getRemainingAmount(), activeBolus.getInitialAmount()));
bolusingEvent.setStatus(rh.gs(R.string.bolus_delivered, activeBolus.getInitialAmount() - activeBolus.getRemainingAmount(), activeBolus.getInitialAmount()));
if (percentBefore != bolusingEvent.getPercent())
rxBus.send(bolusingEvent);
} else {
synchronized ($bolusLock) {
if (bolusCancelled || trials == -1 || trials++ >= 5) {
if (!bolusCancelled) {
bolusingEvent.setStatus(rh.gs(R.string.insight_delivered, insulin, insulin));
bolusingEvent.setStatus(rh.gs(R.string.bolus_delivered, insulin, insulin));
bolusingEvent.setPercent(100);
rxBus.send(bolusingEvent);
}

View file

@ -698,7 +698,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
}
val percent = (waited.toFloat() / estimatedDeliveryTimeSeconds) * 100
updateBolusProgressDialog(
rh.gs(R.string.dash_bolusdelivering, requestedBolusAmount),
rh.gs(R.string.bolus_delivered, percent*requestedBolusAmount/100, requestedBolusAmount),
percent.toInt()
)
}
@ -729,7 +729,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
val remainingUnits = podStateManager.lastBolus!!.bolusUnitsRemaining
val percent = ((requestedBolusAmount - remainingUnits) / requestedBolusAmount) * 100
updateBolusProgressDialog(
rh.gs(R.string.bolusdelivering, requestedBolusAmount),
rh.gs(R.string.bolus_delivered, requestedBolusAmount - remainingUnits, requestedBolusAmount),
percent.toInt()
)

View file

@ -7,6 +7,7 @@
<string name="common_resultok">OK</string>
<string name="pump_serial_number">Pump Serial Number</string>
<string name="bolus_delivered">%1$.2f U / %2$.2f U delivered</string>
<!-- PumpCommon - Pump Status -->