pull/1296/head
gedoor 3 years ago
parent 74f8fe3cfa
commit 91f1bf2c8a
  1. 4
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  2. 52
      app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt

@ -203,9 +203,7 @@ class BookSourceEditActivity :
add(EditEntity("header", source?.header, R.string.source_http_header)) add(EditEntity("header", source?.header, R.string.source_http_header))
add( add(
EditEntity( EditEntity(
"concurrentRate", "concurrentRate", source?.concurrentRate, R.string.source_concurrent_rate
source?.concurrentRate,
R.string.source_concurrent_rate
) )
) )
} }

@ -129,31 +129,36 @@ class RssSourceEditActivity :
binding.recyclerView.adapter = adapter binding.recyclerView.adapter = adapter
} }
private fun upRecyclerView(rssSource: RssSource? = viewModel.rssSource) { private fun upRecyclerView(source: RssSource? = viewModel.rssSource) {
rssSource?.let { source?.let {
binding.cbIsEnable.isChecked = rssSource.enabled binding.cbIsEnable.isChecked = source.enabled
binding.cbSingleUrl.isChecked = rssSource.singleUrl binding.cbSingleUrl.isChecked = source.singleUrl
binding.cbEnableJs.isChecked = rssSource.enableJs binding.cbEnableJs.isChecked = source.enableJs
binding.cbEnableBaseUrl.isChecked = rssSource.loadWithBaseUrl binding.cbEnableBaseUrl.isChecked = source.loadWithBaseUrl
} }
sourceEntities.clear() sourceEntities.clear()
sourceEntities.apply { sourceEntities.apply {
add(EditEntity("sourceName", rssSource?.sourceName, R.string.source_name)) add(EditEntity("sourceName", source?.sourceName, R.string.source_name))
add(EditEntity("sourceUrl", rssSource?.sourceUrl, R.string.source_url)) add(EditEntity("sourceUrl", source?.sourceUrl, R.string.source_url))
add(EditEntity("sourceIcon", rssSource?.sourceIcon, R.string.source_icon)) add(EditEntity("sourceIcon", source?.sourceIcon, R.string.source_icon))
add(EditEntity("sourceGroup", rssSource?.sourceGroup, R.string.source_group)) add(EditEntity("sourceGroup", source?.sourceGroup, R.string.source_group))
add(EditEntity("sourceComment", rssSource?.sourceComment, R.string.comment)) add(EditEntity("sourceComment", source?.sourceComment, R.string.comment))
add(EditEntity("sortUrl", rssSource?.sortUrl, R.string.sort_url)) add(EditEntity("header", source?.header, R.string.source_http_header))
add(EditEntity("ruleArticles", rssSource?.ruleArticles, R.string.r_articles)) add(
add(EditEntity("ruleNextPage", rssSource?.ruleNextPage, R.string.r_next)) EditEntity(
add(EditEntity("ruleTitle", rssSource?.ruleTitle, R.string.r_title)) "concurrentRate", source?.concurrentRate, R.string.source_concurrent_rate
add(EditEntity("rulePubDate", rssSource?.rulePubDate, R.string.r_date)) )
add(EditEntity("ruleDescription", rssSource?.ruleDescription, R.string.r_description)) )
add(EditEntity("ruleImage", rssSource?.ruleImage, R.string.r_image)) add(EditEntity("sortUrl", source?.sortUrl, R.string.sort_url))
add(EditEntity("ruleLink", rssSource?.ruleLink, R.string.r_link)) add(EditEntity("ruleArticles", source?.ruleArticles, R.string.r_articles))
add(EditEntity("ruleContent", rssSource?.ruleContent, R.string.r_content)) add(EditEntity("ruleNextPage", source?.ruleNextPage, R.string.r_next))
add(EditEntity("style", rssSource?.style, R.string.r_style)) add(EditEntity("ruleTitle", source?.ruleTitle, R.string.r_title))
add(EditEntity("header", rssSource?.header, R.string.source_http_header)) add(EditEntity("rulePubDate", source?.rulePubDate, R.string.r_date))
add(EditEntity("ruleDescription", source?.ruleDescription, R.string.r_description))
add(EditEntity("ruleImage", source?.ruleImage, R.string.r_image))
add(EditEntity("ruleLink", source?.ruleLink, R.string.r_link))
add(EditEntity("ruleContent", source?.ruleContent, R.string.r_content))
add(EditEntity("style", source?.style, R.string.r_style))
} }
adapter.editEntities = sourceEntities adapter.editEntities = sourceEntities
} }
@ -171,6 +176,8 @@ class RssSourceEditActivity :
"sourceIcon" -> source.sourceIcon = it.value ?: "" "sourceIcon" -> source.sourceIcon = it.value ?: ""
"sourceGroup" -> source.sourceGroup = it.value "sourceGroup" -> source.sourceGroup = it.value
"sourceComment" -> source.sourceComment = it.value "sourceComment" -> source.sourceComment = it.value
"header" -> source.header = it.value
"concurrentRate" -> source.concurrentRate = it.value
"sortUrl" -> source.sortUrl = it.value "sortUrl" -> source.sortUrl = it.value
"ruleArticles" -> source.ruleArticles = it.value "ruleArticles" -> source.ruleArticles = it.value
"ruleNextPage" -> source.ruleNextPage = it.value "ruleNextPage" -> source.ruleNextPage = it.value
@ -181,7 +188,6 @@ class RssSourceEditActivity :
"ruleLink" -> source.ruleLink = it.value "ruleLink" -> source.ruleLink = it.value
"ruleContent" -> source.ruleContent = it.value "ruleContent" -> source.ruleContent = it.value
"style" -> source.style = it.value "style" -> source.style = it.value
"header" -> source.header = it.value
} }
} }
return source return source

Loading…
Cancel
Save