pull/32/head
kunfei 5 years ago
parent 945217f505
commit fdf12315f4
  1. 4
      app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt
  2. 8
      app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt
  3. 12
      app/src/main/java/io/legado/app/ui/widget/page/PageView.kt

@ -317,8 +317,8 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
observeEvent<Int>(Bus.ALOUD_STATE) { readAloudStatus = it }
observeEvent<Int>(Bus.TTS_START) {}
observeEvent<Int>(Bus.TTS_RANGE_START) {}
observeEvent<String>(Bus.TIME_CHANGED) {}
observeEvent<Int>(Bus.BATTERY_CHANGED) {}
observeEvent<String>(Bus.TIME_CHANGED) { page_view.upTime() }
observeEvent<Int>(Bus.BATTERY_CHANGED) { page_view.upBattery(it) }
observeEventSticky<String>(Bus.READ_ALOUD) { onClickReadAloud() }
}
}

@ -27,6 +27,14 @@ class ContentView : FrameLayout {
page_panel.horizontalPadding = 16.dp
}
fun upTime() {
}
fun upBattery(battery: Int) {
}
fun setContent(text: CharSequence?) {
content_text_view.text = text
}

@ -111,6 +111,18 @@ class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, att
nextPage?.upStyle()
}
fun upTime() {
curPage?.upTime()
prevPage?.upTime()
nextPage?.upTime()
}
fun upBattery(battery: Int) {
curPage?.upBattery(battery)
prevPage?.upBattery(battery)
nextPage?.upBattery(battery)
}
interface CallBack {
fun durChapterIndex(): Int
fun durChapterPos(pageSize: Int): Int

Loading…
Cancel
Save