优化
This commit is contained in:
@@ -91,21 +91,19 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application)
|
|||||||
|
|
||||||
fun selectionAddToGroups(sources: List<BookSource>, groups: String) {
|
fun selectionAddToGroups(sources: List<BookSource>, groups: String) {
|
||||||
execute {
|
execute {
|
||||||
val list = arrayListOf<BookSource>()
|
|
||||||
sources.forEach { source ->
|
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) {
|
fun selectionRemoveFromGroups(sources: List<BookSource>, groups: String) {
|
||||||
execute {
|
execute {
|
||||||
val list = arrayListOf<BookSource>()
|
|
||||||
sources.forEach { source ->
|
sources.forEach { source ->
|
||||||
list.add(source.copy().removeGroup(groups))
|
source.removeGroup(groups)
|
||||||
}
|
}
|
||||||
appDb.bookSourceDao.update(*list.toTypedArray())
|
appDb.bookSourceDao.update(*sources.toTypedArray())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user