From c0be0dba201825b4c99d244d157810a096f444ff Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 8 Sep 2020 08:50:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E7=89=88=E9=A1=B5=E7=9C=89=E9=A1=B5?= =?UTF-8?q?=E8=84=9A=E8=B7=9F=E9=9A=8F=E8=83=8C=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/help/ReadBookConfig.kt | 18 +++++++++- .../java/io/legado/app/help/ReadTipConfig.kt | 36 +++++++++---------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt index 3f810250b..fa6b30aae 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -159,7 +159,7 @@ object ReadBookConfig { var hideStatusBar = App.INSTANCE.getPrefBoolean(PreferKey.hideStatusBar) var hideNavigationBar = App.INSTANCE.getPrefBoolean(PreferKey.hideNavigationBar) - private val config get() = if (shareLayout) getConfig(5) else durConfig + val config get() = if (shareLayout) getConfig(5) else durConfig var textFont: String get() = config.textFont @@ -332,6 +332,14 @@ object ReadBookConfig { exportConfig.footerPaddingTop = shearConfig.footerPaddingTop exportConfig.showHeaderLine = shearConfig.showHeaderLine exportConfig.showFooterLine = shearConfig.showFooterLine + exportConfig.tipHeaderLeft = shearConfig.tipHeaderLeft + exportConfig.tipHeaderMiddle = shearConfig.tipHeaderMiddle + exportConfig.tipHeaderRight = shearConfig.tipHeaderRight + exportConfig.tipFooterLeft = shearConfig.tipFooterLeft + exportConfig.tipFooterMiddle = shearConfig.tipFooterMiddle + exportConfig.tipFooterRight = shearConfig.tipFooterRight + exportConfig.hideHeader = shearConfig.hideHeader + exportConfig.hideFooter = shearConfig.hideFooter } return exportConfig } @@ -375,6 +383,14 @@ object ReadBookConfig { var footerPaddingTop: Int = 6, var showHeaderLine: Boolean = false, var showFooterLine: Boolean = true, + var tipHeaderLeft: Int = ReadTipConfig.time, + var tipHeaderMiddle: Int = ReadTipConfig.none, + var tipHeaderRight: Int = ReadTipConfig.battery, + var tipFooterLeft: Int = ReadTipConfig.chapterTitle, + var tipFooterMiddle: Int = ReadTipConfig.none, + var tipFooterRight: Int = ReadTipConfig.pageAndTotal, + var hideHeader: Boolean = true, + var hideFooter: Boolean = false ) : Parcelable { fun setBg(bgType: Int, bg: String) { when { diff --git a/app/src/main/java/io/legado/app/help/ReadTipConfig.kt b/app/src/main/java/io/legado/app/help/ReadTipConfig.kt index 9d6452b38..eb37a10e1 100644 --- a/app/src/main/java/io/legado/app/help/ReadTipConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadTipConfig.kt @@ -2,10 +2,6 @@ package io.legado.app.help import io.legado.app.App import io.legado.app.R -import io.legado.app.utils.getPrefBoolean -import io.legado.app.utils.getPrefInt -import io.legado.app.utils.putPrefBoolean -import io.legado.app.utils.putPrefInt object ReadTipConfig { val tipArray: Array = App.INSTANCE.resources.getStringArray(R.array.read_tip) @@ -25,50 +21,50 @@ object ReadTipConfig { val tipFooterRightStr: String get() = tipArray.getOrElse(tipFooterRight) { tipArray[none] } var tipHeaderLeft: Int - get() = App.INSTANCE.getPrefInt("tipHeaderLeft", time) + get() = ReadBookConfig.config.tipHeaderLeft set(value) { - App.INSTANCE.putPrefInt("tipHeaderLeft", value) + ReadBookConfig.config.tipHeaderLeft = value } var tipHeaderMiddle: Int - get() = App.INSTANCE.getPrefInt("tipHeaderMiddle", none) + get() = ReadBookConfig.config.tipHeaderMiddle set(value) { - App.INSTANCE.putPrefInt("tipHeaderMiddle", value) + ReadBookConfig.config.tipHeaderMiddle = value } var tipHeaderRight: Int - get() = App.INSTANCE.getPrefInt("tipHeaderRight", battery) + get() = ReadBookConfig.config.tipHeaderRight set(value) { - App.INSTANCE.putPrefInt("tipHeaderRight", value) + ReadBookConfig.config.tipHeaderRight = value } var tipFooterLeft: Int - get() = App.INSTANCE.getPrefInt("tipFooterLeft", chapterTitle) + get() = ReadBookConfig.config.tipFooterLeft set(value) { - App.INSTANCE.putPrefInt("tipFooterLeft", value) + ReadBookConfig.config.tipFooterLeft = value } var tipFooterMiddle: Int - get() = App.INSTANCE.getPrefInt("tipFooterMiddle", none) + get() = ReadBookConfig.config.tipFooterMiddle set(value) { - App.INSTANCE.putPrefInt("tipFooterMiddle", value) + ReadBookConfig.config.tipFooterMiddle = value } var tipFooterRight: Int - get() = App.INSTANCE.getPrefInt("tipFooterRight", pageAndTotal) + get() = ReadBookConfig.config.tipFooterRight set(value) { - App.INSTANCE.putPrefInt("tipFooterRight", value) + ReadBookConfig.config.tipFooterRight = value } var hideHeader: Boolean - get() = App.INSTANCE.getPrefBoolean("hideHeader", true) + get() = ReadBookConfig.config.hideHeader set(value) { - App.INSTANCE.putPrefBoolean("hideHeader", value) + ReadBookConfig.config.hideHeader = value } var hideFooter: Boolean - get() = App.INSTANCE.getPrefBoolean("hideFooter", false) + get() = ReadBookConfig.config.hideFooter set(value) { - App.INSTANCE.putPrefBoolean("hideFooter", value) + ReadBookConfig.config.hideFooter = value } } \ No newline at end of file