mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
优化
This commit is contained in:
parent
cff73c67dc
commit
951a0c91a5
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user