pull/67/head
kunfei 5 years ago
parent 62e99caf75
commit f8d6aafac1
  1. 2
      app/src/main/java/io/legado/app/ui/widget/page/DataSource.kt
  2. 2
      app/src/main/java/io/legado/app/ui/widget/page/PageFactory.kt
  3. 4
      app/src/main/java/io/legado/app/ui/widget/page/PageView.kt
  4. 5
      app/src/main/java/io/legado/app/ui/widget/page/TextPageFactory.kt

@ -9,8 +9,6 @@ interface DataSource {
fun getChapterPosition(): Int
fun getChapter(position: Int): TextChapter?
fun getCurrentChapter(): TextChapter?
fun getNextChapter(): TextChapter?

@ -2,8 +2,6 @@ package io.legado.app.ui.widget.page
abstract class PageFactory<DATA>(protected val dataSource: DataSource) {
abstract fun pageAt(index: Int): DATA?
abstract fun moveToFirst()
abstract fun moveToLast()

@ -190,10 +190,6 @@ class PageView(context: Context, attrs: AttributeSet) :
return ReadBook.durChapterIndex
}
override fun getChapter(position: Int): TextChapter? {
return ReadBook.textChapter(position)
}
override fun getCurrentChapter(): TextChapter? {
return ReadBook.textChapter(0)
}

@ -21,11 +21,6 @@ class TextPageFactory(dataSource: DataSource) : PageFactory<TextPage>(dataSource
}
}
override fun pageAt(index: Int): TextPage {
return dataSource.getCurrentChapter()?.page(index)
?: TextPage(index = index, title = "index:$index")
}
override fun moveToFirst() {
dataSource.setPageIndex(0)
}

Loading…
Cancel
Save