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