Merge remote-tracking branch 'origin/master'

This commit is contained in:
kunfei 2022-01-27 20:03:54 +08:00
commit c2fa51ede7
5 changed files with 27 additions and 0 deletions

View File

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

View File

@ -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)
}
}

View File

@ -12,6 +12,8 @@ import io.legado.app.utils.setLayout
import io.legado.app.utils.toastOnUi
import io.legado.app.utils.viewbindingdelegate.viewBinding
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) {
@ -70,6 +72,7 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config
checkCategory = binding.checkCategory.isChecked
checkContent = binding.checkContent.isChecked
putConfig()
putPrefString(PreferKey.checkSource, summary)
dismiss()
}
}

View File

@ -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)
}
}
}

View File

@ -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>