mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
优化
This commit is contained in:
parent
29d31190dc
commit
98272ab160
@ -308,7 +308,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
|
||||
|
||||
override fun onClickSelectBarMainAction() {
|
||||
alert(titleResource = R.string.draw, messageResource = R.string.sure_del) {
|
||||
okButton { viewModel.delSelection(adapter.selection) }
|
||||
okButton { viewModel.del(*adapter.selection.toTypedArray()) }
|
||||
noButton()
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application)
|
||||
}
|
||||
}
|
||||
|
||||
fun del(bookSource: BookSource) {
|
||||
execute { appDb.bookSourceDao.delete(bookSource) }
|
||||
fun del(vararg sources: BookSource) {
|
||||
execute { appDb.bookSourceDao.delete(*sources) }
|
||||
}
|
||||
|
||||
fun update(vararg bookSource: BookSource) {
|
||||
@ -128,12 +128,6 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application)
|
||||
}
|
||||
}
|
||||
|
||||
fun delSelection(sources: List<BookSource>) {
|
||||
execute {
|
||||
appDb.bookSourceDao.delete(*sources.toTypedArray())
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("BlockingMethodInNonBlockingContext")
|
||||
fun saveToFile(sources: List<BookSource>, success: (file: File) -> Unit) {
|
||||
execute {
|
||||
|
Loading…
Reference in New Issue
Block a user