From 7b80ec9380c727abc670ec2dd00189d699bb9f18 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 23 Oct 2020 11:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/help/ThemeConfig.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/ThemeConfig.kt b/app/src/main/java/io/legado/app/help/ThemeConfig.kt index 74a42a2ed..4f92a039a 100644 --- a/app/src/main/java/io/legado/app/help/ThemeConfig.kt +++ b/app/src/main/java/io/legado/app/help/ThemeConfig.kt @@ -15,16 +15,16 @@ object ThemeConfig { const val configFileName = "themeConfig.json" val configFilePath = FileUtils.getPath(App.INSTANCE.filesDir, configFileName) - val configList = arrayListOf() - - init { - upConfig() + val configList: ArrayList by lazy { + val cList = getConfigs() ?: DefaultData.defaultThemeConfigs + ArrayList(cList) } fun upConfig() { - (getConfigs() ?: DefaultData.defaultThemeConfigs).let { - configList.clear() - configList.addAll(it) + getConfigs()?.let { + it.forEach { config -> + addConfig(config) + } } }