mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
优化
This commit is contained in:
parent
e00907ba33
commit
2cb23a2ef4
@ -91,21 +91,19 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application)
|
||||
|
||||
fun selectionAddToGroups(sources: List<BookSource>, groups: String) {
|
||||
execute {
|
||||
val list = arrayListOf<BookSource>()
|
||||
sources.forEach { source ->
|
||||
list.add(source.copy().addGroup(groups))
|
||||
source.addGroup(groups)
|
||||
}
|
||||
appDb.bookSourceDao.update(*list.toTypedArray())
|
||||
appDb.bookSourceDao.update(*sources.toTypedArray())
|
||||
}
|
||||
}
|
||||
|
||||
fun selectionRemoveFromGroups(sources: List<BookSource>, groups: String) {
|
||||
execute {
|
||||
val list = arrayListOf<BookSource>()
|
||||
sources.forEach { source ->
|
||||
list.add(source.copy().removeGroup(groups))
|
||||
source.removeGroup(groups)
|
||||
}
|
||||
appDb.bookSourceDao.update(*list.toTypedArray())
|
||||
appDb.bookSourceDao.update(*sources.toTypedArray())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user