From 2cb23a2ef4d965d7a3a1cbf982b5c6034b3a85eb Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 23 Jan 2022 08:07:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/source/manage/BookSourceViewModel.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt index cf1c8535c..68b739f20 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt @@ -91,21 +91,19 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) fun selectionAddToGroups(sources: List, groups: String) { execute { - val list = arrayListOf() 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, groups: String) { execute { - val list = arrayListOf() sources.forEach { source -> - list.add(source.copy().removeGroup(groups)) + source.removeGroup(groups) } - appDb.bookSourceDao.update(*list.toTypedArray()) + appDb.bookSourceDao.update(*sources.toTypedArray()) } }