瀏覽代碼

Don't dismiss DialogFragment's when in background

They shall be dismissed automatically. Doing it here may cause
IllegalStateException.

Note that even if they are dismissed, the corresponding tasks will
continue to be executed by EuiccChannelManagerService and will not be
cancelled.
Peter Cai 1 年之前
父節點
當前提交
aac457f4b5

+ 5 - 1
app-common/src/main/java/im/angry/openeuicc/ui/ProfileDeleteFragment.kt

@@ -81,7 +81,11 @@ class ProfileDeleteFragment : DialogFragment(), EuiccChannelFragmentMarker {
                     (parentFragment as EuiccProfilesChangedListener).onEuiccProfilesChanged()
                 }
 
-                dismiss()
+                try {
+                    dismiss()
+                } catch (e: IllegalStateException) {
+                    // Ignored
+                }
             }.collect()
         }
     }

+ 6 - 1
app-common/src/main/java/im/angry/openeuicc/ui/ProfileDownloadFragment.kt

@@ -230,7 +230,12 @@ class ProfileDownloadFragment : BaseMaterialDialogFragment(),
             if (parentFragment is EuiccProfilesChangedListener) {
                 (parentFragment as EuiccProfilesChangedListener).onEuiccProfilesChanged()
             }
-            dismiss()
+
+            try {
+                dismiss()
+            } catch (e: IllegalStateException) {
+                // Ignored
+            }
         }
     }
 

+ 5 - 1
app-common/src/main/java/im/angry/openeuicc/ui/ProfileRenameFragment.kt

@@ -106,7 +106,11 @@ class ProfileRenameFragment : BaseMaterialDialogFragment(), EuiccChannelFragment
                 (parentFragment as EuiccProfilesChangedListener).onEuiccProfilesChanged()
             }
 
-            dismiss()
+            try {
+                dismiss()
+            } catch (e: IllegalStateException) {
+                // Ignored
+            }
         }
     }
 }