pull/32/head
kunfei 5 years ago
parent e26532ec7f
commit 930e4ae6fb
  1. 1
      app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt
  3. 10
      app/src/main/java/io/legado/app/ui/widget/page/TextPageFactory.kt
  4. 47
      app/src/main/res/layout/view_book_page.xml

@ -53,6 +53,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
initAnimation() initAnimation()
initView() initView()
page_view.callback = this
viewModel.callBack = this viewModel.callBack = this
viewModel.bookData.observe(this, Observer { title_bar.title = it.name }) viewModel.bookData.observe(this, Observer { title_bar.title = it.name })
viewModel.chapterListFinish.observe(this, Observer { bookLoadFinish() }) viewModel.chapterListFinish.observe(this, Observer { bookLoadFinish() })

@ -57,6 +57,6 @@ class ContentView : FrameLayout {
fun setContent(page: TextPage?) { fun setContent(page: TextPage?) {
content_text_view.text = page?.text content_text_view.text = page?.text
//bottom_status_bar draw index tv_bottom_right.text = page?.index?.toString()
} }
} }

@ -47,16 +47,18 @@ class TextPageFactory private constructor(dataSource: DataSource) : PageFactory<
} }
override fun currentPage(): TextPage? { override fun currentPage(): TextPage? {
// return dataSource.getCurrentChapter()?.page(index) return dataSource.getCurrentChapter()?.page(index)
return TextPage(index, "index:$index") // return TextPage(index, "index:$index")
} }
override fun nextPage(): TextPage? { override fun nextPage(): TextPage? {
return TextPage(index + 1, "index:${index + 1}") return dataSource.getCurrentChapter()?.page(index + 1)
// return TextPage(index + 1, "index:${index + 1}")
} }
override fun previousPage(): TextPage? { override fun previousPage(): TextPage? {
return TextPage(index - 1, "index:${index - 1}") return dataSource.getCurrentChapter()?.page(index - 1)
// return TextPage(index - 1, "index:${index - 1}")
} }

@ -8,27 +8,46 @@
app:divider="@drawable/ic_divider" app:divider="@drawable/ic_divider"
app:showDividers="middle"> app:showDividers="middle">
<View <LinearLayout
android:id="@+id/top_status_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="25dp" /> android:layout_height="wrap_content"
android:orientation="horizontal">
<FrameLayout <TextView
android:id="@+id/content_panel" android:id="@+id/tv_top_left"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_weight="1"> android:layout_weight="1" />
<TextView
android:id="@+id/tv_top_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<io.legado.app.ui.widget.page.ContentTextView <io.legado.app.ui.widget.page.ContentTextView
android:id="@+id/content_text_view" android:id="@+id/content_text_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="0dp"
android:layout_weight="1" />
</FrameLayout>
<View <LinearLayout
android:id="@+id/bottom_status_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="25dp" /> android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_bottom_left"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/tv_bottom_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
Loading…
Cancel
Save