mirror of
https://github.com/gedoor/legado.git
synced 2024-07-19 01:17:25 +08:00
优化
This commit is contained in:
parent
967aeacc18
commit
49704cd632
@ -4,7 +4,6 @@ package io.legado.app.utils
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.cardview.widget.CardView
|
||||
@ -14,6 +13,7 @@ import io.legado.app.R
|
||||
import io.legado.app.help.config.AppConfig
|
||||
import io.legado.app.lib.theme.bottomBackground
|
||||
import io.legado.app.lib.theme.getPrimaryTextColor
|
||||
import splitties.views.inflate
|
||||
|
||||
private var toast: Toast? = null
|
||||
|
||||
@ -31,7 +31,7 @@ fun Context.toastOnUi(message: CharSequence?, duration: Int = Toast.LENGTH_SHORT
|
||||
if (toast == null || BuildConfig.DEBUG || AppConfig.recordLog) {
|
||||
toast?.cancel()
|
||||
toast = Toast(this)
|
||||
toast?.view = LayoutInflater.from(this).inflate(R.layout.view_toast, null)
|
||||
toast?.view = inflate(R.layout.view_toast)
|
||||
}
|
||||
val toastView = toast?.view!!
|
||||
val cardView = toastView.findViewById<CardView>(R.id.cv_content)
|
||||
|
Loading…
Reference in New Issue
Block a user