feat: ToastUtils 的 toast 默认切换到主线程执行
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package com.gh.gamecenter.core.utils
|
||||
|
||||
import com.gh.gamecenter.core.HaloApp
|
||||
import com.gh.gamecenter.core.runOnUiThread
|
||||
import com.lightgame.utils.toast.ToastHelper
|
||||
|
||||
object ToastUtils {
|
||||
@ -12,12 +13,16 @@ object ToastUtils {
|
||||
|
||||
@JvmStatic
|
||||
fun showToast(message: String) {
|
||||
ToastHelper.showToast(HaloApp.getInstance(), message)
|
||||
runOnUiThread {
|
||||
ToastHelper.showToast(HaloApp.getInstance(), message)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showToast(message: String, gravity: Int = -1, yOffset: Int = 0) {
|
||||
ToastHelper.showToast(HaloApp.getInstance(), message, gravity, yOffset)
|
||||
runOnUiThread {
|
||||
ToastHelper.showToast(HaloApp.getInstance(), message, gravity, yOffset)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user