temp fix of bolus progress crash

This commit is contained in:
Milos Kozak 2016-08-18 09:10:32 +02:00
parent 38ee1402a4
commit 08d940b2fb
2 changed files with 10 additions and 5 deletions

View file

@ -351,9 +351,9 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
PumpEnactResult result = activePump.deliverTreatment(insulin, carbs, context);
bolusProgressDialog.bolusEnded = true;
BolusProgressDialog.bolusEnded = true;
if (bolusProgressDialog != null && bolusProgressDialog.running) {
if (bolusProgressDialog != null && BolusProgressDialog.running) {
try {
bolusProgressDialog.dismiss();
} catch (Exception e) {
@ -393,9 +393,9 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
PumpEnactResult result = activePump.deliverTreatment(insulin, carbs, context);
bolusProgressDialog.bolusEnded = true;
BolusProgressDialog.bolusEnded = true;
if (bolusProgressDialog != null && bolusProgressDialog.running) {
if (bolusProgressDialog != null && BolusProgressDialog.running) {
try {
bolusProgressDialog.dismiss();
} catch (Exception e) {

View file

@ -146,13 +146,18 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
} catch (InterruptedException e) {
e.printStackTrace();
}
BolusProgressDialog.bolusEnded = true;
Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(
new Runnable() {
@Override
public void run() {
dismiss();
try {
dismiss();
} catch (Exception e) {
e.printStackTrace(); // TODO: do this better way
}
}
});
}