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 b1a17905f..d0e67e901 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -251,6 +251,12 @@ object ReadBookConfig { if (shareLayout) shareConfig.footerPaddingTop = value else durConfig.footerPaddingTop = value + var showHeaderLine: Boolean + get() = if (shareLayout) shareConfig.showHeaderLine else durConfig.showHeaderLine + set(value) = + if (shareLayout) shareConfig.showHeaderLine = value + else durConfig.showHeaderLine = value + var showFooterLine: Boolean get() = if (shareLayout) shareConfig.showFooterLine else durConfig.showFooterLine set(value) = @@ -288,6 +294,7 @@ object ReadBookConfig { var footerPaddingLeft: Int = 16, var footerPaddingRight: Int = 16, var footerPaddingTop: Int = 6, + var showHeaderLine: Boolean = false, var showFooterLine: Boolean = true ) { fun setBg(bgType: Int, bg: String) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt index a19789fd3..ed1c296de 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt @@ -76,7 +76,8 @@ class PaddingConfigDialog : DialogFragment() { dsb_footer_padding_bottom.progress = footerPaddingBottom dsb_footer_padding_left.progress = footerPaddingLeft dsb_footer_padding_right.progress = footerPaddingRight - cb_show_line.isChecked = showFooterLine + cb_show_top_line.isChecked = showHeaderLine + cb_show_bottom_line.isChecked = showFooterLine } private fun initView() = with(ReadBookConfig) { @@ -131,7 +132,13 @@ class PaddingConfigDialog : DialogFragment() { footerPaddingRight = it postEvent(EventBus.UP_CONFIG, true) } - cb_show_line.onCheckedChangeListener = { cb, isChecked -> + cb_show_top_line.onCheckedChangeListener = { cb, isChecked -> + if (cb.isPressed) { + showHeaderLine = isChecked + postEvent(EventBus.UP_CONFIG, true) + } + } + cb_show_bottom_line.onCheckedChangeListener = { cb, isChecked -> if (cb.isPressed) { showFooterLine = isChecked postEvent(EventBus.UP_CONFIG, true) 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 5ecc2bba3..96a2ce454 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 @@ -61,6 +61,7 @@ class ContentView(context: Context) : FrameLayout(context) { footerPaddingRight.dp, footerPaddingBottom.dp ) + vw_top_divider.visible(showHeaderLine) vw_bottom_divider.visible(showFooterLine) content_text_view.upVisibleRect() durConfig.textColor().let { diff --git a/app/src/main/res/layout/dialog_read_padding.xml b/app/src/main/res/layout/dialog_read_padding.xml index 79b89ec40..d867c6814 100644 --- a/app/src/main/res/layout/dialog_read_padding.xml +++ b/app/src/main/res/layout/dialog_read_padding.xml @@ -11,19 +11,20 @@ android:id="@+id/ll_header_padding" android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="center_vertical" android:orientation="vertical"> @@ -128,7 +129,7 @@ android:text="@string/showLine" />