more progress dialog tweaking

This commit is contained in:
Milos Kozak 2016-08-14 20:19:47 +02:00
parent e95650d54d
commit bb041b1c06
2 changed files with 14 additions and 2 deletions

View file

@ -390,8 +390,14 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
PumpEnactResult result = activePump.deliverTreatment(insulin, carbs, context);
if (bolusProgressDialog != null) {
bolusProgressDialog.dismiss();
bolusProgressDialog.bolusEnded = true;
if (bolusProgressDialog != null && bolusProgressDialog.running) {
try {
bolusProgressDialog.dismiss();
} catch (Exception e) {
e.printStackTrace(); // TODO: handle this better
}
}
if (Config.logCongigBuilderActions)

View file

@ -31,6 +31,8 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
ProgressBar progressBar;
static double amount;
public static boolean bolusEnded = false;
public static boolean running = true;
boolean started = false;
@ -40,6 +42,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
public BolusProgressDialog(double amount) {
this.amount = amount;
bolusEnded = false;
}
@Override
@ -63,12 +66,15 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
public void onResume() {
super.onResume();
MainApp.bus().register(this);
running = true;
if (bolusEnded) dismiss();
}
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
running = false;
}
@Override