|
|
@ -36,7 +36,6 @@ class ContentView : FrameLayout { |
|
|
|
//设置背景防止切换背景时文字重叠 |
|
|
|
//设置背景防止切换背景时文字重叠 |
|
|
|
setBackgroundColor(context.getCompatColor(R.color.background)) |
|
|
|
setBackgroundColor(context.getCompatColor(R.color.background)) |
|
|
|
inflate(context, R.layout.view_book_page, this) |
|
|
|
inflate(context, R.layout.view_book_page, this) |
|
|
|
top_bar.layoutParams.height = context.getStatusBarHeight() |
|
|
|
|
|
|
|
upStyle() |
|
|
|
upStyle() |
|
|
|
upTime() |
|
|
|
upTime() |
|
|
|
content_text_view.customSelectionActionModeCallback = |
|
|
|
content_text_view.customSelectionActionModeCallback = |
|
|
@ -53,15 +52,35 @@ class ContentView : FrameLayout { |
|
|
|
|
|
|
|
|
|
|
|
fun upStyle() { |
|
|
|
fun upStyle() { |
|
|
|
ReadBookConfig.getConfig().apply { |
|
|
|
ReadBookConfig.getConfig().apply { |
|
|
|
val pt = if (context.getPrefBoolean(PreferKey.hideStatusBar, false)) { |
|
|
|
val rootPaddingTop = if (context.getPrefBoolean(PreferKey.hideStatusBar, false)) { |
|
|
|
top_bar.visible() |
|
|
|
//显示状态栏时隐藏header |
|
|
|
|
|
|
|
ll_header.visible() |
|
|
|
|
|
|
|
ll_header.layoutParams = |
|
|
|
|
|
|
|
ll_header.layoutParams.apply { height = context.getStatusBarHeight() } |
|
|
|
|
|
|
|
ll_header.setPadding( |
|
|
|
|
|
|
|
headerPaddingLeft, |
|
|
|
|
|
|
|
headerPaddingTop, |
|
|
|
|
|
|
|
headerPaddingRight, |
|
|
|
|
|
|
|
headerPaddingBottom |
|
|
|
|
|
|
|
) |
|
|
|
0 |
|
|
|
0 |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
top_bar.gone() |
|
|
|
ll_header.gone() |
|
|
|
context.getStatusBarHeight() |
|
|
|
context.getStatusBarHeight() |
|
|
|
} |
|
|
|
} |
|
|
|
page_panel.setPadding(paddingLeft.dp, pt, paddingRight.dp, 0) |
|
|
|
page_panel.setPadding(0.dp, rootPaddingTop, 0, 0) |
|
|
|
content_text_view.setPadding(0, paddingTop.dp, 0, paddingBottom.dp) |
|
|
|
content_text_view.setPadding( |
|
|
|
|
|
|
|
paddingLeft.dp, |
|
|
|
|
|
|
|
paddingTop.dp, |
|
|
|
|
|
|
|
paddingRight.dp, |
|
|
|
|
|
|
|
paddingBottom.dp |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
ll_footer.setPadding( |
|
|
|
|
|
|
|
footerPaddingLeft.dp, |
|
|
|
|
|
|
|
footerPaddingTop.dp, |
|
|
|
|
|
|
|
footerPaddingRight.dp, |
|
|
|
|
|
|
|
footerPaddingBottom.dp |
|
|
|
|
|
|
|
) |
|
|
|
content_text_view.textSize = textSize.toFloat() |
|
|
|
content_text_view.textSize = textSize.toFloat() |
|
|
|
content_text_view.setLineSpacing(lineSpacingExtra.toFloat(), lineSpacingMultiplier) |
|
|
|
content_text_view.setLineSpacing(lineSpacingExtra.toFloat(), lineSpacingMultiplier) |
|
|
|
content_text_view.letterSpacing = letterSpacing |
|
|
|
content_text_view.letterSpacing = letterSpacing |
|
|
|