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:
Johannes Mockenhaupt 2017-12-20 16:58:33 +00:00
commit 7651107167
2 changed files with 19 additions and 18 deletions

View file

@ -160,17 +160,12 @@ 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,
notifyAboutNewCommand(); // not when the Bolus command is starting. The command closes the dialog upon completion).
// Notify Wear about upcoming bolus
MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin));
// Bring up bolus progress dialog
if (detailedBolusInfo.context != null) { if (detailedBolusInfo.context != null) {
BolusProgressDialog bolusProgressDialog = new BolusProgressDialog(); BolusProgressDialog bolusProgressDialog = new BolusProgressDialog();
bolusProgressDialog.setInsulin(detailedBolusInfo.insulin); bolusProgressDialog.setInsulin(detailedBolusInfo.insulin);
@ -182,6 +177,16 @@ public class CommandQueue {
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i); MainApp.instance().startActivity(i);
} }
// Notify Wear about upcoming bolus
MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin));
}
notifyAboutNewCommand();
// Notify Wear about upcoming bolus
MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin));
notifyAboutNewCommand();
return true; return true;
} }

View file

@ -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();
} }