diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt index 6c502615e..8d5cdc422 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt @@ -26,6 +26,7 @@ object ChapterProvider { private var paddingTop = 0 private var lineSpacingExtra = 0f private var paragraphSpacing = 0 + var typeface: Typeface = Typeface.SANS_SERIF var titlePaint = TextPaint() var contentPaint = TextPaint() private var bodyIndent = BookHelp.bodyIndent @@ -35,7 +36,7 @@ object ChapterProvider { } fun upStyle(config: ReadBookConfig.Config) { - val typeface: Typeface = try { + typeface = try { val fontPath = App.INSTANCE.getPrefString(PreferKey.readBookFont) if (!TextUtils.isEmpty(fontPath)) { Typeface.createFromFile(fontPath) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt index aedf2e8b9..1651f7d6e 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt @@ -19,7 +19,7 @@ import java.util.* class ContentView : FrameLayout { var callBack: CallBack? = null - var headerHeight = 0 + private var headerHeight = 0 private var pageSize: Int = 0 constructor(context: Context) : super(context) { @@ -40,6 +40,10 @@ class ContentView : FrameLayout { fun upStyle() { ReadBookConfig.durConfig.apply { + tv_top_left.typeface = ChapterProvider.typeface + tv_top_right.typeface = ChapterProvider.typeface + tv_bottom_left.typeface = ChapterProvider.typeface + tv_bottom_right.typeface = ChapterProvider.typeface if (context.getPrefBoolean(PreferKey.hideStatusBar, false)) { //显示状态栏时隐藏header ll_header.visible()