mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
Merge branch 'master' into master
This commit is contained in:
commit
6cdc15b43c
@ -107,7 +107,7 @@
|
|||||||
placeholder="是否加载url (启用: true 关闭: false (可选,默认true))"></textarea>
|
placeholder="是否加载url (启用: true 关闭: false (可选,默认true))"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div>启用JS :</div>
|
<div>启用JS :</div>
|
||||||
<textarea rows="1" id="enableJs" class="base" title="enableJs"
|
<textarea rows="1" id="enableJs" class="base" title="enableJs"
|
||||||
placeholder="是否启用Js (启用: true 关闭: false (可选,默认true))"></textarea>
|
placeholder="是否启用Js (启用: true 关闭: false (可选,默认true))"></textarea>
|
||||||
</div>
|
</div>
|
||||||
@ -148,6 +148,11 @@
|
|||||||
<textarea rows="1" id="customOrder" class="base" title="customOrder"
|
<textarea rows="1" id="customOrder" class="base" title="customOrder"
|
||||||
placeholder="整数: 0~N (可选,默认0) | 数字越小越靠前"></textarea>
|
placeholder="整数: 0~N (可选,默认0) | 数字越小越靠前"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<div>单URL :</div>
|
||||||
|
<textarea rows="1" id="singleUrl" class="base" title="singleUrl"
|
||||||
|
placeholder="启用: true 关闭: false (可选,false)"></textarea>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
|
@ -83,8 +83,9 @@ function rule2json() {
|
|||||||
RuleJSON.customOrder = RuleJSON.customOrder == '' ? 0 : parseInt(RuleJSON.customOrder);
|
RuleJSON.customOrder = RuleJSON.customOrder == '' ? 0 : parseInt(RuleJSON.customOrder);
|
||||||
RuleJSON.articleStyle = RuleJSON.articleStyle == '' ? 0 : parseInt(RuleJSON.articleStyle);
|
RuleJSON.articleStyle = RuleJSON.articleStyle == '' ? 0 : parseInt(RuleJSON.articleStyle);
|
||||||
RuleJSON.enabled = RuleJSON.enabled == '' || String(RuleJSON.enabled).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true';
|
RuleJSON.enabled = RuleJSON.enabled == '' || String(RuleJSON.enabled).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true';
|
||||||
RuleJSON.loadWithBaseUrl = RuleJSON.loadWithBaseUrl == '' || String(RuleJSON.loadWithBaseUrl).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true';
|
|
||||||
RuleJSON.enableJs = RuleJSON.enableJs == '' || String(RuleJSON.enableJs).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true';
|
RuleJSON.enableJs = RuleJSON.enableJs == '' || String(RuleJSON.enableJs).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true';
|
||||||
|
RuleJSON.loadWithBaseUrl = RuleJSON.loadWithBaseUrl == '' || String(RuleJSON.loadWithBaseUrl).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true';
|
||||||
|
RuleJSON.singleUrl = RuleJSON.singleUrl == '' || String(RuleJSON.singleUrl).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true';
|
||||||
return RuleJSON;
|
return RuleJSON;
|
||||||
}
|
}
|
||||||
// 将源对象填充到源表单
|
// 将源对象填充到源表单
|
||||||
|
@ -118,18 +118,20 @@ data class BookSource(
|
|||||||
|
|
||||||
fun getContentRule() = ruleContent ?: ContentRule()
|
fun getContentRule() = ruleContent ?: ContentRule()
|
||||||
|
|
||||||
fun addGroup(group: String) {
|
fun addGroup(group: String): BookSource {
|
||||||
bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let {
|
bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let {
|
||||||
it.add(group)
|
it.add(group)
|
||||||
bookSourceGroup = TextUtils.join(",", it)
|
bookSourceGroup = TextUtils.join(",", it)
|
||||||
}
|
}
|
||||||
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun removeGroup(group: String) {
|
fun removeGroup(group: String): BookSource {
|
||||||
bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let {
|
bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let {
|
||||||
it.remove(group)
|
it.remove(group)
|
||||||
bookSourceGroup = TextUtils.join(",", it)
|
bookSourceGroup = TextUtils.join(",", it)
|
||||||
}
|
}
|
||||||
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun equal(source: BookSource) =
|
fun equal(source: BookSource) =
|
||||||
|
@ -3,7 +3,6 @@ package io.legado.app.ui.book.source.manage
|
|||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import io.legado.app.base.BaseViewModel
|
import io.legado.app.base.BaseViewModel
|
||||||
import io.legado.app.constant.AppPattern
|
|
||||||
import io.legado.app.data.appDb
|
import io.legado.app.data.appDb
|
||||||
import io.legado.app.data.entities.BookSource
|
import io.legado.app.data.entities.BookSource
|
||||||
import io.legado.app.utils.*
|
import io.legado.app.utils.*
|
||||||
@ -92,23 +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 ->
|
||||||
source.addGroup(groups)
|
source.addGroup(groups)
|
||||||
list.add(source)
|
|
||||||
}
|
}
|
||||||
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 ->
|
||||||
source.removeGroup(groups)
|
source.removeGroup(groups)
|
||||||
list.add(source)
|
|
||||||
}
|
}
|
||||||
appDb.bookSourceDao.update(*list.toTypedArray())
|
appDb.bookSourceDao.update(*sources.toTypedArray())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user