Horis 3 лет назад
Родитель
Сommit
cd7de90062
1 измененных файлов с 5 добавлено и 6 удалено
  1. 5 6
      app/src/main/java/io/legado/app/utils/ToastUtils.kt

+ 5 - 6
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<CardView>(R.id.cv_content)
             cardView.setCardBackgroundColor(bottomBackground)
             val isLight = ColorUtils.isColorLight(bottomBackground)