From 74fda1fc17e14ce4b2103dfa048e1df4ba94ffcf Mon Sep 17 00:00:00 2001 From: juntao Date: Thu, 21 Jul 2022 16:18:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20ToastUtils=20=E7=9A=84=20toast=20?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=88=87=E6=8D=A2=E5=88=B0=E4=B8=BB=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/gh/gamecenter/core/utils/ToastUtils.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/module_core/src/main/java/com/gh/gamecenter/core/utils/ToastUtils.kt b/module_core/src/main/java/com/gh/gamecenter/core/utils/ToastUtils.kt index 950a243502..d7d2da3cd3 100644 --- a/module_core/src/main/java/com/gh/gamecenter/core/utils/ToastUtils.kt +++ b/module_core/src/main/java/com/gh/gamecenter/core/utils/ToastUtils.kt @@ -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) + } } }