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.ReadTipConfig
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 java.util.*
@ -23,6 +26,9 @@ class ContentView(context: Context) : FrameLayout(context) {
private var battery = 100
val headerHeight: Int
get() = if (ReadBookConfig.hideStatusBar) ll_header.height else context.statusBarHeight
init {
//设置背景防止切换背景时文字重叠
setBackgroundColor(context.getCompatColor(R.color.background))
@ -49,19 +55,14 @@ class ContentView(context: Context) : FrameLayout(context) {
tv_footer_middle.setColor(durConfig.textColor())
tv_footer_right.setColor(durConfig.textColor())
//显示状态栏时隐藏header
if (hideStatusBar) {
vw_status_bar.setPadding(0, context.statusBarHeight, 0, 0)
vw_status_bar.isGone = hideStatusBar
ll_header.setPadding(
headerPaddingLeft.dp,
headerPaddingTop.dp,
headerPaddingRight.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(
footerPaddingLeft.dp,
footerPaddingTop.dp,
@ -90,15 +91,8 @@ class ContentView(context: Context) : FrameLayout(context) {
tv_footer_left.isInvisible = tipFooterLeftNone
tv_footer_right.isGone = tipFooterRightNone
tv_footer_middle.isGone = tipFooterMiddleNone
}
}
val headerHeight: Int
get() {
return if (ReadBookConfig.hideStatusBar) {
ll_header.height
} else {
context.statusBarHeight
ll_header.isGone = hideHeader
ll_footer.isGone = hideFooter
}
}

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

Loading…
Cancel
Save