From 8ea5b7d6bcdd8654cc35719f37301ba1793a9c86 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Sat, 5 Feb 2022 17:30:02 +0800 Subject: [PATCH] =?UTF-8?q?BookSource.kt:=E7=A7=BB=E9=99=A4=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=86=E7=BB=84=E6=94=AF=E6=8C=81=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=EF=BC=9B=E4=BF=AE=E5=A4=8D=E5=9C=A8=E6=B2=A1=E6=9C=89=E5=88=86?= =?UTF-8?q?=E7=BB=84=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E7=BB=84=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/data/entities/BookSource.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/entities/BookSource.kt b/app/src/main/java/io/legado/app/data/entities/BookSource.kt index 2643ced1b..354089406 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookSource.kt @@ -118,17 +118,18 @@ data class BookSource( fun getContentRule() = ruleContent ?: ContentRule() - fun addGroup(group: String): BookSource { + fun addGroup(groups: String): BookSource { bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let { - it.add(group) + it.addAll(groups.splitNotBlank(AppPattern.splitGroupRegex)) bookSourceGroup = TextUtils.join(",", it) } + if (bookSourceGroup.isNullOrBlank()) bookSourceGroup = groups return this } - fun removeGroup(group: String): BookSource { + fun removeGroup(groups: String): BookSource { bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let { - it.remove(group) + it.removeAll(groups.splitNotBlank(AppPattern.splitGroupRegex)) bookSourceGroup = TextUtils.join(",", it) } return this