From cd7de90062a3a0c07c0adcb847441dbe4723d333 Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Fri, 17 Nov 2023 23:01:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/utils/ToastUtils.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/utils/ToastUtils.kt b/app/src/main/java/io/legado/app/utils/ToastUtils.kt index 91440ce14..da96ee53a 100644 --- a/app/src/main/java/io/legado/app/utils/ToastUtils.kt +++ b/app/src/main/java/io/legado/app/utils/ToastUtils.kt @@ -4,6 +4,7 @@ package io.legado.app.utils import android.annotation.SuppressLint import android.content.Context +import android.view.View import android.widget.TextView import android.widget.Toast import androidx.cardview.widget.CardView @@ -28,12 +29,10 @@ fun Context.toastOnUi(message: Int, duration: Int = Toast.LENGTH_SHORT) { fun Context.toastOnUi(message: CharSequence?, duration: Int = Toast.LENGTH_SHORT) { runOnUI { kotlin.runCatching { - if (toast == null || BuildConfig.DEBUG || AppConfig.recordLog) { - toast?.cancel() - toast = Toast(this) - toast?.view = inflate(R.layout.view_toast) - } - val toastView = toast?.view!! + toast?.cancel() + toast = Toast(this) + val toastView: View = inflate(R.layout.view_toast) + toast?.view = toastView val cardView = toastView.findViewById(R.id.cv_content) cardView.setCardBackgroundColor(bottomBackground) val isLight = ColorUtils.isColorLight(bottomBackground)