Settings: Fix sometimes reset progress dialog not dismissed

The display of reset progress dialog takes time. User can initiate multiple clicks and show multiple progress dialogs during the internal. But in fact, only once dismiss request initiated.

Check the reset progress dialog, if it is showing, dismiss it firstly before show another reset progress dialog.

Change-Id: Ia944990ea489927b38be59b1f7a8ad66fc8b669a
Buganizer: 227413950
This commit is contained in:
hoffc
2022-03-30 14:18:11 +08:00
parent d35c876857
commit 6771edae5c

View File

@@ -150,7 +150,10 @@ public class ResetNetworkConfirm extends InstrumentedFragment {
@Override
protected void onPostExecute(Boolean succeeded) {
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
if (succeeded) {
Toast.makeText(mContext, R.string.reset_network_complete_toast, Toast.LENGTH_SHORT)
.show();
@@ -189,6 +192,12 @@ public class ResetNetworkConfirm extends InstrumentedFragment {
}
}
// Should dismiss the progress dialog firstly if it is showing
// Or not the progress dialog maybe not dismissed in fast clicking.
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
mProgressDialog = getProgressDialog(mActivity);
mProgressDialog.show();