From b5a7fa30d75da7d003f529727b002ce7d8d5d030 Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Sun, 24 Apr 2022 20:35:28 +0800 Subject: [PATCH] optimize plugin load --- app/src/main/assets/updatelog.fy | 3 ++- app/src/main/java/xyz/fycz/myreader/util/utils/PluginUtils.kt | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/assets/updatelog.fy b/app/src/main/assets/updatelog.fy index ef421d8..c28a49e 100644 --- a/app/src/main/assets/updatelog.fy +++ b/app/src/main/assets/updatelog.fy @@ -1,8 +1,9 @@ -2022.03.31 +2022.04.24 风月读书v2.4.4 更新内容: 1、修复软件无法打开的问题(超时时间为5s) 2、修复DIY书源重复显示订阅书源的问题 +3、优化动态插件加载 2022.03.29 风月读书v2.4.3 diff --git a/app/src/main/java/xyz/fycz/myreader/util/utils/PluginUtils.kt b/app/src/main/java/xyz/fycz/myreader/util/utils/PluginUtils.kt index 7e164b7..c71bfd3 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/utils/PluginUtils.kt +++ b/app/src/main/java/xyz/fycz/myreader/util/utils/PluginUtils.kt @@ -49,6 +49,7 @@ import java.util.* object PluginUtils { val TAG = PluginUtils.javaClass.simpleName + var hasLoad = false fun init() { val pluginConfigUrl = @@ -94,6 +95,7 @@ object PluginUtils { } private fun loadAppLoader(context: Context, config: PluginConfig?) { + if (hasLoad) return config?.let { val pluginPath = APPCONST.PLUGIN_DIR_PATH + it.name val desFile = File(pluginPath) @@ -114,6 +116,7 @@ object PluginUtils { appParam.appInfo = context.applicationInfo onLoad(appParam) } + hasLoad = true } catch (e: Exception) { e.printStackTrace() }