瀏覽代碼

fix: 字体重置问题

HapeLee 5 月之前
父節點
當前提交
7d333f8b6c
共有 1 個文件被更改,包括 3 次插入 和 9 次删除
  1. 3 9
      app/src/main/java/io/legado/app/ui/config/themeConfig/ThemeConfig.kt

+ 3 - 9
app/src/main/java/io/legado/app/ui/config/themeConfig/ThemeConfig.kt

@@ -7,10 +7,7 @@ import io.legado.app.constant.EventBus
 import io.legado.app.constant.PreferKey
 import io.legado.app.constant.PreferKey
 import io.legado.app.ui.config.prefDelegate
 import io.legado.app.ui.config.prefDelegate
 import io.legado.app.utils.GSON
 import io.legado.app.utils.GSON
-import io.legado.app.utils.getPrefString
 import io.legado.app.utils.postEvent
 import io.legado.app.utils.postEvent
-import io.legado.app.utils.putPrefString
-import splitties.init.appCtx
 
 
 data class TagColorPair(
 data class TagColorPair(
     val textColor: Int = 0,
     val textColor: Int = 0,
@@ -88,12 +85,9 @@ object ThemeConfig {
         postEvent(EventBus.RECREATE, "")
         postEvent(EventBus.RECREATE, "")
     }
     }
 
 
-    var appFontPath: String?
-        get() = appCtx.getPrefString(PreferKey.appFontPath)
-        set(value) {
-            appCtx.putPrefString(PreferKey.appFontPath, value)
-            postEvent(EventBus.RECREATE, "")
-        }
+    var appFontPath by prefDelegate<String?>(PreferKey.appFontPath, null) {
+        postEvent(EventBus.RECREATE, "")
+    }
 
 
     var cPrimary by prefDelegate(PreferKey.cPrimary, 0)
     var cPrimary by prefDelegate(PreferKey.cPrimary, 0)