优化
This commit is contained in:
@@ -146,7 +146,7 @@ class CheckSourceService : BaseService() {
|
||||
if (source.hasGroup("搜索失效") && url.isNullOrBlank()) {
|
||||
throw NoStackTraceException("搜索内容为空并且没有发现")
|
||||
}
|
||||
books = WebBook.exploreBookAwait(this, source, url)
|
||||
books = WebBook.exploreBookAwait(this, source, url!!)
|
||||
if (books.isEmpty()) {
|
||||
throw NoStackTraceException("发现书籍为空")
|
||||
}
|
||||
|
||||
@@ -137,7 +137,13 @@ class FileAssociationActivity :
|
||||
}
|
||||
}
|
||||
}.onFailure {
|
||||
toastOnUi(it.localizedMessage)
|
||||
when (it) {
|
||||
is SecurityException -> localBookTreeSelect.launch {
|
||||
title = "选择保存书籍的文件夹"
|
||||
mode = HandleFileContract.DIR_SYS
|
||||
}
|
||||
else -> toastOnUi(it.localizedMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,49 +10,57 @@ private var toast: Toast? = null
|
||||
|
||||
fun Context.toastOnUi(message: Int) {
|
||||
runOnUI {
|
||||
if (toast == null) {
|
||||
toast = Toast.makeText(this, message, Toast.LENGTH_SHORT)
|
||||
} else {
|
||||
toast?.setText(message)
|
||||
toast?.duration = Toast.LENGTH_SHORT
|
||||
kotlin.runCatching {
|
||||
if (toast == null) {
|
||||
toast = Toast.makeText(this, message, Toast.LENGTH_SHORT)
|
||||
} else {
|
||||
toast?.setText(message)
|
||||
toast?.duration = Toast.LENGTH_SHORT
|
||||
}
|
||||
toast?.show()
|
||||
}
|
||||
toast?.show()
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.toastOnUi(message: CharSequence?) {
|
||||
runOnUI {
|
||||
if (toast == null) {
|
||||
toast = Toast.makeText(this, message, Toast.LENGTH_SHORT)
|
||||
} else {
|
||||
toast?.setText(message)
|
||||
toast?.duration = Toast.LENGTH_SHORT
|
||||
kotlin.runCatching {
|
||||
if (toast == null) {
|
||||
toast = Toast.makeText(this, message, Toast.LENGTH_SHORT)
|
||||
} else {
|
||||
toast?.setText(message)
|
||||
toast?.duration = Toast.LENGTH_SHORT
|
||||
}
|
||||
toast?.show()
|
||||
}
|
||||
toast?.show()
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.longToastOnUi(message: Int) {
|
||||
runOnUI {
|
||||
if (toast == null) {
|
||||
toast = Toast.makeText(this, message, Toast.LENGTH_LONG)
|
||||
} else {
|
||||
toast?.setText(message)
|
||||
toast?.duration = Toast.LENGTH_LONG
|
||||
kotlin.runCatching {
|
||||
if (toast == null) {
|
||||
toast = Toast.makeText(this, message, Toast.LENGTH_LONG)
|
||||
} else {
|
||||
toast?.setText(message)
|
||||
toast?.duration = Toast.LENGTH_LONG
|
||||
}
|
||||
toast?.show()
|
||||
}
|
||||
toast?.show()
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.longToastOnUi(message: CharSequence?) {
|
||||
runOnUI {
|
||||
if (toast == null) {
|
||||
toast = Toast.makeText(this, message, Toast.LENGTH_LONG)
|
||||
} else {
|
||||
toast?.setText(message)
|
||||
toast?.duration = Toast.LENGTH_LONG
|
||||
kotlin.runCatching {
|
||||
if (toast == null) {
|
||||
toast = Toast.makeText(this, message, Toast.LENGTH_LONG)
|
||||
} else {
|
||||
toast?.setText(message)
|
||||
toast?.duration = Toast.LENGTH_LONG
|
||||
}
|
||||
toast?.show()
|
||||
}
|
||||
toast?.show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user