This commit is contained in:
Johannes Mockenhaupt 2018-05-02 21:24:06 +02:00
parent 8419f8d0e9
commit 22e90743aa
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -70,16 +70,25 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (getDialog() != null) if (bolusEnded) {
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); dismiss();
MainApp.bus().register(this); } else {
running = true; if (getDialog() != null)
if (bolusEnded) dismiss(); getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
MainApp.bus().register(this);
running = true;
}
} }
@Override @Override
public void dismiss() { public void dismiss() {
super.dismiss(); try {
super.dismiss();
} catch (IllegalStateException e) {
// dialog not running yet. onResume will try again. Set bolusEnded to make extra
// sure onResume will catch this
bolusEnded = true;
}
if (helperActivity != null) { if (helperActivity != null) {
helperActivity.finish(); helperActivity.finish();
} }