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