From 6771edae5cf680b20102a0c93b194b616ee750fe Mon Sep 17 00:00:00 2001 From: hoffc Date: Wed, 30 Mar 2022 14:18:11 +0800 Subject: [PATCH] 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 --- src/com/android/settings/ResetNetworkConfirm.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/ResetNetworkConfirm.java b/src/com/android/settings/ResetNetworkConfirm.java index eff487b9348..30d159bbb04 100644 --- a/src/com/android/settings/ResetNetworkConfirm.java +++ b/src/com/android/settings/ResetNetworkConfirm.java @@ -150,7 +150,10 @@ public class ResetNetworkConfirm extends InstrumentedFragment { @Override protected void onPostExecute(Boolean succeeded) { - mProgressDialog.dismiss(); + 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();