This commit is contained in:
马增飞
2025-11-17 16:27:00 +08:00
parent 99001fff2f
commit f8eeb83c6f
@@ -17,6 +17,7 @@ object Loading {
private var dialog: LoadingDialog? = null private var dialog: LoadingDialog? = null
fun show(activity: Activity) { fun show(activity: Activity) {
try {
if (activity.isFinishing || activity.isDestroyed) { if (activity.isFinishing || activity.isDestroyed) {
return return
} }
@@ -27,15 +28,22 @@ object Loading {
dialog = LoadingDialog(activity) dialog = LoadingDialog(activity)
} }
dialog?.show() dialog?.show()
} catch (e: Exception) {
e.printStackTrace()
}
} }
fun dismiss() { fun dismiss() {
try {
dialog?.let { dialog?.let {
if (it.isShowing) { if (it.isShowing) {
it.dismiss() it.dismiss()
} }
} }
dialog = null dialog = null
} catch (e: Exception) {
e.printStackTrace()
}
} }
} }