优化
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package io.legado.app.ui.book.source.edit
|
package io.legado.app.ui.book.source.edit
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
@@ -388,6 +387,7 @@ class BookSourceEditActivity :
|
|||||||
val contentRule = ContentRule()
|
val contentRule = ContentRule()
|
||||||
// val reviewRule = ReviewRule()
|
// val reviewRule = ReviewRule()
|
||||||
sourceEntities.forEach {
|
sourceEntities.forEach {
|
||||||
|
it.value = it.value?.takeIf { s -> s.isNotBlank() }
|
||||||
when (it.key) {
|
when (it.key) {
|
||||||
"bookSourceUrl" -> source.bookSourceUrl = it.value ?: ""
|
"bookSourceUrl" -> source.bookSourceUrl = it.value ?: ""
|
||||||
"bookSourceName" -> source.bookSourceName = it.value ?: ""
|
"bookSourceName" -> source.bookSourceName = it.value ?: ""
|
||||||
@@ -405,6 +405,7 @@ class BookSourceEditActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
searchEntities.forEach {
|
searchEntities.forEach {
|
||||||
|
it.value = it.value?.takeIf { s -> s.isNotBlank() }
|
||||||
when (it.key) {
|
when (it.key) {
|
||||||
"searchUrl" -> source.searchUrl = it.value
|
"searchUrl" -> source.searchUrl = it.value
|
||||||
"checkKeyWord" -> searchRule.checkKeyWord = it.value
|
"checkKeyWord" -> searchRule.checkKeyWord = it.value
|
||||||
@@ -438,6 +439,7 @@ class BookSourceEditActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exploreEntities.forEach {
|
exploreEntities.forEach {
|
||||||
|
it.value = it.value?.takeIf { s -> s.isNotBlank() }
|
||||||
when (it.key) {
|
when (it.key) {
|
||||||
"exploreUrl" -> source.exploreUrl = it.value
|
"exploreUrl" -> source.exploreUrl = it.value
|
||||||
"bookList" -> exploreRule.bookList = it.value
|
"bookList" -> exploreRule.bookList = it.value
|
||||||
@@ -470,6 +472,7 @@ class BookSourceEditActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
infoEntities.forEach {
|
infoEntities.forEach {
|
||||||
|
it.value = it.value?.takeIf { s -> s.isNotBlank() }
|
||||||
when (it.key) {
|
when (it.key) {
|
||||||
"init" -> bookInfoRule.init = it.value
|
"init" -> bookInfoRule.init = it.value
|
||||||
"name" -> bookInfoRule.name = viewModel.ruleComplete(it.value, bookInfoRule.init)
|
"name" -> bookInfoRule.name = viewModel.ruleComplete(it.value, bookInfoRule.init)
|
||||||
@@ -503,6 +506,7 @@ class BookSourceEditActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
tocEntities.forEach {
|
tocEntities.forEach {
|
||||||
|
it.value = it.value?.takeIf { s -> s.isNotBlank() }
|
||||||
when (it.key) {
|
when (it.key) {
|
||||||
"preUpdateJs" -> tocRule.preUpdateJs = it.value
|
"preUpdateJs" -> tocRule.preUpdateJs = it.value
|
||||||
"chapterList" -> tocRule.chapterList = it.value
|
"chapterList" -> tocRule.chapterList = it.value
|
||||||
@@ -522,6 +526,7 @@ class BookSourceEditActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
contentEntities.forEach {
|
contentEntities.forEach {
|
||||||
|
it.value = it.value?.takeIf { s -> s.isNotBlank() }
|
||||||
when (it.key) {
|
when (it.key) {
|
||||||
"content" -> contentRule.content = viewModel.ruleComplete(it.value)
|
"content" -> contentRule.content = viewModel.ruleComplete(it.value)
|
||||||
"title" -> contentRule.title = viewModel.ruleComplete(it.value)
|
"title" -> contentRule.title = viewModel.ruleComplete(it.value)
|
||||||
|
|||||||
@@ -281,6 +281,7 @@ class RssSourceEditActivity :
|
|||||||
source.singleUrl = binding.cbSingleUrl.isChecked
|
source.singleUrl = binding.cbSingleUrl.isChecked
|
||||||
source.enabledCookieJar = binding.cbIsEnableCookie.isChecked
|
source.enabledCookieJar = binding.cbIsEnableCookie.isChecked
|
||||||
sourceEntities.forEach {
|
sourceEntities.forEach {
|
||||||
|
it.value = it.value?.takeIf { s -> s.isNotBlank() }
|
||||||
when (it.key) {
|
when (it.key) {
|
||||||
"sourceName" -> source.sourceName = it.value ?: ""
|
"sourceName" -> source.sourceName = it.value ?: ""
|
||||||
"sourceUrl" -> source.sourceUrl = it.value ?: ""
|
"sourceUrl" -> source.sourceUrl = it.value ?: ""
|
||||||
@@ -299,6 +300,7 @@ class RssSourceEditActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
listEntities.forEach {
|
listEntities.forEach {
|
||||||
|
it.value = it.value?.takeIf { s -> s.isNotBlank() }
|
||||||
when (it.key) {
|
when (it.key) {
|
||||||
"ruleArticles" -> source.ruleArticles = it.value
|
"ruleArticles" -> source.ruleArticles = it.value
|
||||||
"ruleNextPage" -> source.ruleNextPage =
|
"ruleNextPage" -> source.ruleNextPage =
|
||||||
@@ -321,6 +323,7 @@ class RssSourceEditActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
webViewEntities.forEach {
|
webViewEntities.forEach {
|
||||||
|
it.value = it.value?.takeIf { s -> s.isNotBlank() }
|
||||||
when (it.key) {
|
when (it.key) {
|
||||||
"enableJs" -> source.enableJs = it.value.isTrue()
|
"enableJs" -> source.enableJs = it.value.isTrue()
|
||||||
"loadWithBaseUrl" -> source.loadWithBaseUrl = it.value.isTrue()
|
"loadWithBaseUrl" -> source.loadWithBaseUrl = it.value.isTrue()
|
||||||
|
|||||||
Reference in New Issue
Block a user