mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
Merge pull request #1588 from Xwite/master
BookSource.kt:移除添加分组支持多个;修复在没有分组的情况下无法添加分组的bug
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user