Merge branch 'bolus-progress-dialog' into 'smb060'
Only show progress dialog for normal boluses, not SMBs. See merge request MilosKozak/AndroidAPS!375
This commit is contained in:
commit
7651107167
|
@ -160,28 +160,33 @@ public class CommandQueue {
|
||||||
detailedBolusInfo.carbs = MainApp.getConfigBuilder().applyCarbsConstraints((int) detailedBolusInfo.carbs);
|
detailedBolusInfo.carbs = MainApp.getConfigBuilder().applyCarbsConstraints((int) detailedBolusInfo.carbs);
|
||||||
|
|
||||||
// add new command to queue
|
// add new command to queue
|
||||||
if (detailedBolusInfo.isSMB)
|
if (detailedBolusInfo.isSMB) {
|
||||||
add(new CommandSMBBolus(detailedBolusInfo, callback));
|
add(new CommandSMBBolus(detailedBolusInfo, callback));
|
||||||
else
|
} else {
|
||||||
add(new CommandBolus(detailedBolusInfo, callback));
|
add(new CommandBolus(detailedBolusInfo, callback));
|
||||||
|
// Bring up bolus progress dialog (start here, so the dialog is shown when the bolus is requested,
|
||||||
|
// not when the Bolus command is starting. The command closes the dialog upon completion).
|
||||||
|
if (detailedBolusInfo.context != null) {
|
||||||
|
BolusProgressDialog bolusProgressDialog = new BolusProgressDialog();
|
||||||
|
bolusProgressDialog.setInsulin(detailedBolusInfo.insulin);
|
||||||
|
bolusProgressDialog.show(((AppCompatActivity) detailedBolusInfo.context).getSupportFragmentManager(), "BolusProgress");
|
||||||
|
} else {
|
||||||
|
Intent i = new Intent();
|
||||||
|
i.putExtra("insulin", detailedBolusInfo.insulin);
|
||||||
|
i.setClass(MainApp.instance(), BolusProgressHelperActivity.class);
|
||||||
|
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
MainApp.instance().startActivity(i);
|
||||||
|
}
|
||||||
|
// Notify Wear about upcoming bolus
|
||||||
|
MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin));
|
||||||
|
}
|
||||||
|
|
||||||
notifyAboutNewCommand();
|
notifyAboutNewCommand();
|
||||||
|
|
||||||
// Notify Wear about upcoming bolus
|
// Notify Wear about upcoming bolus
|
||||||
MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin));
|
MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin));
|
||||||
|
|
||||||
// Bring up bolus progress dialog
|
notifyAboutNewCommand();
|
||||||
if (detailedBolusInfo.context != null) {
|
|
||||||
BolusProgressDialog bolusProgressDialog = new BolusProgressDialog();
|
|
||||||
bolusProgressDialog.setInsulin(detailedBolusInfo.insulin);
|
|
||||||
bolusProgressDialog.show(((AppCompatActivity) detailedBolusInfo.context).getSupportFragmentManager(), "BolusProgress");
|
|
||||||
} else {
|
|
||||||
Intent i = new Intent();
|
|
||||||
i.putExtra("insulin", detailedBolusInfo.insulin);
|
|
||||||
i.setClass(MainApp.instance(), BolusProgressHelperActivity.class);
|
|
||||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
MainApp.instance().startActivity(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,10 +36,6 @@ public class CommandSMBBolus extends Command {
|
||||||
log.debug("SMB bolus canceled. delivetAt=" + detailedBolusInfo.deliverAt + " now=" + System.currentTimeMillis());
|
log.debug("SMB bolus canceled. delivetAt=" + detailedBolusInfo.deliverAt + " now=" + System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BolusProgressDialog.bolusEnded = true;
|
|
||||||
MainApp.bus().post(new EventDismissBolusprogressIfRunning(r));
|
|
||||||
|
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
callback.result(r).run();
|
callback.result(r).run();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue