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() {
|
override fun onClickSelectBarMainAction() {
|
||||||
alert(titleResource = R.string.draw, messageResource = R.string.sure_del) {
|
alert(titleResource = R.string.draw, messageResource = R.string.sure_del) {
|
||||||
okButton { viewModel.delSelection(adapter.selection) }
|
okButton { viewModel.del(*adapter.selection.toTypedArray()) }
|
||||||
noButton()
|
noButton()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,8 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun del(bookSource: BookSource) {
|
fun del(vararg sources: BookSource) {
|
||||||
execute { appDb.bookSourceDao.delete(bookSource) }
|
execute { appDb.bookSourceDao.delete(*sources) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun update(vararg bookSource: BookSource) {
|
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")
|
@Suppress("BlockingMethodInNonBlockingContext")
|
||||||
fun saveToFile(sources: List<BookSource>, success: (file: File) -> Unit) {
|
fun saveToFile(sources: List<BookSource>, success: (file: File) -> Unit) {
|
||||||
execute {
|
execute {
|
||||||
|
Loading…
Reference in New Issue
Block a user