feat: tipConfig

pull/193/head^2
kunfei 5 years ago
parent f363b467de
commit 8167c3e7f2
  1. 28
      app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt
  2. 5
      app/src/main/res/layout/view_book_page.xml

@ -14,7 +14,10 @@ import io.legado.app.help.AppConfig
import io.legado.app.help.ReadBookConfig import io.legado.app.help.ReadBookConfig
import io.legado.app.help.ReadTipConfig import io.legado.app.help.ReadTipConfig
import io.legado.app.ui.book.read.page.entities.TextPage import io.legado.app.ui.book.read.page.entities.TextPage
import io.legado.app.utils.* import io.legado.app.utils.dp
import io.legado.app.utils.getCompatColor
import io.legado.app.utils.statusBarHeight
import io.legado.app.utils.visible
import kotlinx.android.synthetic.main.view_book_page.view.* import kotlinx.android.synthetic.main.view_book_page.view.*
import java.util.* import java.util.*
@ -23,6 +26,9 @@ class ContentView(context: Context) : FrameLayout(context) {
private var battery = 100 private var battery = 100
val headerHeight: Int
get() = if (ReadBookConfig.hideStatusBar) ll_header.height else context.statusBarHeight
init { init {
//设置背景防止切换背景时文字重叠 //设置背景防止切换背景时文字重叠
setBackgroundColor(context.getCompatColor(R.color.background)) setBackgroundColor(context.getCompatColor(R.color.background))
@ -49,19 +55,14 @@ class ContentView(context: Context) : FrameLayout(context) {
tv_footer_middle.setColor(durConfig.textColor()) tv_footer_middle.setColor(durConfig.textColor())
tv_footer_right.setColor(durConfig.textColor()) tv_footer_right.setColor(durConfig.textColor())
//显示状态栏时隐藏header //显示状态栏时隐藏header
if (hideStatusBar) { vw_status_bar.setPadding(0, context.statusBarHeight, 0, 0)
vw_status_bar.isGone = hideStatusBar
ll_header.setPadding( ll_header.setPadding(
headerPaddingLeft.dp, headerPaddingLeft.dp,
headerPaddingTop.dp, headerPaddingTop.dp,
headerPaddingRight.dp, headerPaddingRight.dp,
headerPaddingBottom.dp headerPaddingBottom.dp
) )
ll_header.visible()
page_panel.setPadding(0, 0, 0, 0)
} else {
ll_header.gone()
page_panel.setPadding(0, context.statusBarHeight, 0, 0)
}
ll_footer.setPadding( ll_footer.setPadding(
footerPaddingLeft.dp, footerPaddingLeft.dp,
footerPaddingTop.dp, footerPaddingTop.dp,
@ -90,15 +91,8 @@ class ContentView(context: Context) : FrameLayout(context) {
tv_footer_left.isInvisible = tipFooterLeftNone tv_footer_left.isInvisible = tipFooterLeftNone
tv_footer_right.isGone = tipFooterRightNone tv_footer_right.isGone = tipFooterRightNone
tv_footer_middle.isGone = tipFooterMiddleNone tv_footer_middle.isGone = tipFooterMiddleNone
} ll_header.isGone = hideHeader
} ll_footer.isGone = hideFooter
val headerHeight: Int
get() {
return if (ReadBookConfig.hideStatusBar) {
ll_header.height
} else {
context.statusBarHeight
} }
} }

@ -6,6 +6,11 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<View
android:id="@+id/vw_status_bar"
android:layout_width="match_parent"
android:layout_height="0dp" />
<LinearLayout <LinearLayout
android:id="@+id/ll_header" android:id="@+id/ll_header"
android:layout_width="match_parent" android:layout_width="match_parent"

Loading…
Cancel
Save