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 (bolusEnded) {
dismiss();
} else {
if (getDialog() != null) if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
MainApp.bus().register(this); MainApp.bus().register(this);
running = true; running = true;
if (bolusEnded) dismiss(); }
} }
@Override @Override
public void dismiss() { public void dismiss() {
try {
super.dismiss(); 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();
} }