From 7e6c4cd9356439ae240f15d2006fe17d1c7e75bf Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 2 Dec 2020 16:02:19 +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 --- .../app/ui/book/read/page/ContentView.kt | 52 ++++++++++--------- 1 file changed, 28 insertions(+), 24 deletions(-) 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 603fdc3fe..61f98b5f9 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 @@ -58,16 +58,20 @@ class ContentView(context: Context) : FrameLayout(context) { } fun upStyle() = with(binding) { - ReadBookConfig.apply { - bvHeaderLeft.typeface = ChapterProvider.typeface - tvHeaderLeft.typeface = ChapterProvider.typeface - tvHeaderMiddle.typeface = ChapterProvider.typeface - tvHeaderRight.typeface = ChapterProvider.typeface - bvFooterLeft.typeface = ChapterProvider.typeface - tvFooterLeft.typeface = ChapterProvider.typeface - tvFooterMiddle.typeface = ChapterProvider.typeface - tvFooterRight.typeface = ChapterProvider.typeface - val tipColor = if (ReadTipConfig.tipColor == 0) textColor else ReadTipConfig.tipColor + ChapterProvider.let { + bvHeaderLeft.typeface = it.typeface + tvHeaderLeft.typeface = it.typeface + tvHeaderMiddle.typeface = it.typeface + tvHeaderRight.typeface = it.typeface + bvFooterLeft.typeface = it.typeface + tvFooterLeft.typeface = it.typeface + tvFooterMiddle.typeface = it.typeface + tvFooterRight.typeface = it.typeface + } + ReadBookConfig.let { + val tipColor = with(ReadTipConfig) { + if (tipColor == 0) it.textColor else tipColor + } bvHeaderLeft.setColor(tipColor) tvHeaderLeft.setColor(tipColor) tvHeaderMiddle.setColor(tipColor) @@ -78,26 +82,26 @@ class ContentView(context: Context) : FrameLayout(context) { tvFooterRight.setColor(tipColor) upStatusBar() llHeader.setPadding( - headerPaddingLeft.dp, - headerPaddingTop.dp, - headerPaddingRight.dp, - headerPaddingBottom.dp + it.headerPaddingLeft.dp, + it.headerPaddingTop.dp, + it.headerPaddingRight.dp, + it.headerPaddingBottom.dp ) llFooter.setPadding( - footerPaddingLeft.dp, - footerPaddingTop.dp, - footerPaddingRight.dp, - footerPaddingBottom.dp + it.footerPaddingLeft.dp, + it.footerPaddingTop.dp, + it.footerPaddingRight.dp, + it.footerPaddingBottom.dp ) - vwTopDivider.visible(showHeaderLine) - vwBottomDivider.visible(showFooterLine) + vwTopDivider.visible(it.showHeaderLine) + vwBottomDivider.visible(it.showFooterLine) pageNvBar.layoutParams = pageNvBar.layoutParams.apply { - height = if (hideNavigationBar) 0 else App.navigationBarHeight + height = if (it.hideNavigationBar) 0 else App.navigationBarHeight } - contentTextView.upVisibleRect() - upTime() - upBattery(battery) } + contentTextView.upVisibleRect() + upTime() + upBattery(battery) } /**