From d85bb7db4dfaf36ff213ac50281e253f45a496ce Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 13 Aug 2016 12:47:15 +0200 Subject: [PATCH] fix double treatment upload from wizard --- .../plugins/ConfigBuilder/ConfigBuilderPlugin.java | 12 +++++++++++- .../plugins/Overview/Dialogs/WizardDialog.java | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java index 9b999a4cf0..9bf0fa8ea8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java @@ -337,7 +337,17 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain insulin = applyBolusConstraints(insulin); carbs = applyCarbsConstraints(carbs); - PumpEnactResult result = deliverTreatment(insulin, carbs, context); + BolusProgressDialog bolusProgressDialog = null; + if (context != null) { + bolusProgressDialog = new BolusProgressDialog(insulin); + bolusProgressDialog.show(((AppCompatActivity) context).getSupportFragmentManager(), "BolusProgress"); + } + + PumpEnactResult result = activePump.deliverTreatment(insulin, carbs, context); + + if (bolusProgressDialog != null) { + bolusProgressDialog.dismiss(); + } if (Config.logCongigBuilderActions) log.debug("deliverTreatmentFromBolusWizard insulin: " + insulin + " carbs: " + carbs + " success: " + result.success + " enacted: " + result.enacted + " bolusDelivered: " + result.bolusDelivered); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java index 883b1f7646..1fdfd2a454 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java @@ -83,7 +83,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener { Context parentContext; public WizardDialog(Context context) { - mHandlerThread = new HandlerThread(NewExtendedBolusDialog.class.getSimpleName()); + mHandlerThread = new HandlerThread(WizardDialog.class.getSimpleName()); mHandlerThread.start(); mHandler = new Handler(mHandlerThread.getLooper()); parentContext = context;