添加summary

pull/1564/head
Xwite 3 years ago
parent 22fd55c958
commit 1e76768644
  1. 1
      app/src/main/assets/updateLog.md
  2. 17
      app/src/main/java/io/legado/app/model/CheckSource.kt
  3. 3
      app/src/main/java/io/legado/app/ui/config/CheckSourceConfig.kt
  4. 5
      app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt
  5. 1
      app/src/main/res/values/strings.xml

@ -15,6 +15,7 @@
* 修复web写源订阅源保存失败bug
* http朗读下载错误连续5次后自动暂停
* 添加其他设置-校验设置
* 其它一些优化
**2022/01/20**

@ -8,6 +8,7 @@ import io.legado.app.service.CheckSourceService
import io.legado.app.utils.startService
import io.legado.app.utils.toastOnUi
import io.legado.app.help.CacheManager
import splitties.init.appCtx
object CheckSource {
var keyword = "我的"
@ -18,6 +19,11 @@ object CheckSource {
var checkInfo = CacheManager.get("checkInfo")?.toBoolean() ?: true
var checkCategory = CacheManager.get("checkCategory")?.toBoolean() ?: true
var checkContent = CacheManager.get("checkContent")?.toBoolean() ?: true
var summary = ""
init {
upSummary()
}
fun start(context: Context, sources: List<BookSource>) {
if (sources.isEmpty()) {
@ -47,5 +53,16 @@ object CheckSource {
CacheManager.put("checkInfo", checkInfo)
CacheManager.put("checkCategory", checkCategory)
CacheManager.put("checkContent", checkContent)
upSummary()
}
fun upSummary() {
summary = ""
if (checkSearch) summary = "${summary} ${appCtx.getString(R.string.search)}"
if (checkDiscovery) summary = "${summary} ${appCtx.getString(R.string.discovery)}"
if (checkInfo) summary = "${summary} ${appCtx.getString(R.string.source_tab_info)}"
if (checkCategory) summary = "${summary} ${appCtx.getString(R.string.chapter_list)}"
if (checkContent) summary = "${summary} ${appCtx.getString(R.string.main_body)}"
summary = appCtx.getString(R.string.check_source_config_summary, (timeout / 1000).toString(), summary)
}
}

@ -12,6 +12,8 @@ import io.legado.app.utils.setLayout
import io.legado.app.utils.viewbindingdelegate.viewBinding
import io.legado.app.utils.toastOnUi
import splitties.views.onClick
import io.legado.app.constant.PreferKey
import io.legado.app.utils.putPrefString
class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config) {
@ -64,6 +66,7 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config
checkCategory = binding.checkCategory?.isChecked
checkContent = binding.checkContent?.isChecked
putConfig()
putPrefString(PreferKey.checkSource, summary)
dismiss()
}
}

@ -12,6 +12,7 @@ import io.legado.app.R
import io.legado.app.base.BasePreferenceFragment
import io.legado.app.constant.EventBus
import io.legado.app.constant.PreferKey
import io.legado.app.model.CheckSource
import io.legado.app.databinding.DialogEditTextBinding
import io.legado.app.help.AppConfig
import io.legado.app.help.BookHelp
@ -52,6 +53,7 @@ class OtherConfigFragment : BasePreferenceFragment(),
AppConfig.defaultBookTreeUri?.let {
upPreferenceSummary(PreferKey.defaultBookTreeUri, it)
}
upPreferenceSummary(PreferKey.checkSource, CheckSource.summary)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -134,6 +136,9 @@ class OtherConfigFragment : BasePreferenceFragment(),
PreferKey.userAgent -> listView.post {
upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent)
}
PreferKey.checkSource -> listView.post {
upPreferenceSummary(PreferKey.checkSource, CheckSource.summary)
}
}
}

@ -929,5 +929,6 @@
<string name="seconds"></string>
<string name="less_than">小于</string>
<string name="error_check_source_config">搜索发现至少校验一个</string>
<string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string>
<!-- string end -->
</resources>

Loading…
Cancel
Save