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