|
|
@ -18,11 +18,10 @@ import java.util.* |
|
|
|
|
|
|
|
|
|
|
|
class ContentView : FrameLayout { |
|
|
|
class ContentView : FrameLayout { |
|
|
|
var callBack: CallBack? = null |
|
|
|
var callBack: CallBack? = null |
|
|
|
private var isScroll: Boolean = false |
|
|
|
var headerHeight = 0 |
|
|
|
private var pageSize: Int = 0 |
|
|
|
private var pageSize: Int = 0 |
|
|
|
|
|
|
|
|
|
|
|
constructor(context: Context) : super(context) { |
|
|
|
constructor(context: Context) : super(context) { |
|
|
|
this.isScroll = true |
|
|
|
|
|
|
|
init() |
|
|
|
init() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -40,7 +39,7 @@ class ContentView : FrameLayout { |
|
|
|
|
|
|
|
|
|
|
|
fun upStyle() { |
|
|
|
fun upStyle() { |
|
|
|
ReadBookConfig.durConfig.apply { |
|
|
|
ReadBookConfig.durConfig.apply { |
|
|
|
val rootPaddingTop = if (context.getPrefBoolean(PreferKey.hideStatusBar, false)) { |
|
|
|
if (context.getPrefBoolean(PreferKey.hideStatusBar, false)) { |
|
|
|
//显示状态栏时隐藏header |
|
|
|
//显示状态栏时隐藏header |
|
|
|
ll_header.visible() |
|
|
|
ll_header.visible() |
|
|
|
ll_header.layoutParams = |
|
|
|
ll_header.layoutParams = |
|
|
@ -51,12 +50,13 @@ class ContentView : FrameLayout { |
|
|
|
headerPaddingRight.dp, |
|
|
|
headerPaddingRight.dp, |
|
|
|
headerPaddingBottom.dp |
|
|
|
headerPaddingBottom.dp |
|
|
|
) |
|
|
|
) |
|
|
|
0 |
|
|
|
headerHeight = ll_header.height |
|
|
|
|
|
|
|
page_panel.setPadding(0, 0, 0, 0) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ll_header.gone() |
|
|
|
ll_header.gone() |
|
|
|
context.getStatusBarHeight() |
|
|
|
headerHeight = context.getStatusBarHeight() |
|
|
|
|
|
|
|
page_panel.setPadding(0, headerHeight, 0, 0) |
|
|
|
} |
|
|
|
} |
|
|
|
page_panel.setPadding(0, rootPaddingTop, 0, 0) |
|
|
|
|
|
|
|
content_text_view.setPadding( |
|
|
|
content_text_view.setPadding( |
|
|
|
paddingLeft.dp, |
|
|
|
paddingLeft.dp, |
|
|
|
paddingTop.dp, |
|
|
|
paddingTop.dp, |
|
|
@ -111,8 +111,8 @@ class ContentView : FrameLayout { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun selectText(e: MotionEvent) { |
|
|
|
fun selectText(e: MotionEvent) { |
|
|
|
|
|
|
|
val y = e.y - headerHeight |
|
|
|
|
|
|
|
content_text_view.selectText(e.x, y) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun scrollTo(pos: Int?) { |
|
|
|
fun scrollTo(pos: Int?) { |
|
|
|