From a43ca6c521a0ca22ed5c5ca16a725ccb1356d4df Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Fri, 4 Feb 2022 12:34:23 +0800 Subject: [PATCH] =?UTF-8?q?CheckSource.kt=E4=B8=8D=E4=BD=BF=E7=94=A8init?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/model/CheckSource.kt | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/CheckSource.kt b/app/src/main/java/io/legado/app/model/CheckSource.kt index 9e144c8ad..5f1813402 100644 --- a/app/src/main/java/io/legado/app/model/CheckSource.kt +++ b/app/src/main/java/io/legado/app/model/CheckSource.kt @@ -18,11 +18,7 @@ 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() - } + val summary get() = upSummary() fun start(context: Context, sources: List) { val selectedIds: ArrayList = arrayListOf() @@ -48,16 +44,15 @@ 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) + fun upSummary(): String { + var checkItem = "" + if (checkSearch) checkItem = "${checkItem} ${appCtx.getString(R.string.search)}" + if (checkDiscovery) checkItem = "${checkItem} ${appCtx.getString(R.string.discovery)}" + if (checkInfo) checkItem = "${checkItem} ${appCtx.getString(R.string.source_tab_info)}" + if (checkCategory) checkItem = "${checkItem} ${appCtx.getString(R.string.chapter_list)}" + if (checkContent) checkItem = "${checkItem} ${appCtx.getString(R.string.main_body)}" + return appCtx.getString(R.string.check_source_config_summary, (timeout / 1000).toString(), checkItem) } } \ No newline at end of file