优化
This commit is contained in:
@@ -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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user