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