Skip to content

Commit 984deb2

Browse files
committed
Fix #97
1 parent 708f52f commit 984deb2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

simpledialogfragments/src/main/java/eltos/simpledialogfragment/SimpleProgressDialog.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package eltos.simpledialogfragment;
1818

19+
import android.os.AsyncTask;
1920
import android.os.Bundle;
2021
import android.text.TextUtils;
2122
import android.view.View;
@@ -282,13 +283,21 @@ public void updateFinished(){
282283
setPositiveButtonEnabled(true);
283284
setNeutralButtonEnabled(false);
284285
if (getArgs().getBoolean(AUTO_DISMISS)){
285-
dismiss();
286+
dismissAllowingStateLoss(); // ok to fail if stopped, will dismiss in onResume
286287
callResultListener(COMPLETED, new Bundle());
287288
}
288289
}
289290
}
290291

291-
292+
@Override
293+
public void onResume() {
294+
super.onResume();
295+
if (getArgs().getBoolean(AUTO_DISMISS)) {
296+
if (mTask != null && mTask.getStatus() == AsyncTask.Status.FINISHED) {
297+
dismiss();
298+
}
299+
}
300+
}
292301

293302
/**
294303
* Set or update the progress text at the start of the progress bar /

0 commit comments

Comments
 (0)