feat: 优化代码

pull/115/head
kunfei 5 years ago
parent d6a81504d4
commit ff4721019c
  1. 14
      app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt

@ -101,14 +101,16 @@ class PageView(context: Context, attrs: AttributeSet) :
}
fun upContent(position: Int = 0) {
pageFactory.let {
if (isScrollDelegate) {
curPage.setContent(pageFactory.currentPage())
} else {
when (position) {
-1 -> prevPage.setContent(it.previousPage())
1 -> nextPage.setContent(it.nextPage())
-1 -> prevPage.setContent(pageFactory.previousPage())
1 -> nextPage.setContent(pageFactory.nextPage())
else -> {
curPage.setContent(it.currentPage())
nextPage.setContent(it.nextPage())
prevPage.setContent(it.previousPage())
curPage.setContent(pageFactory.currentPage())
nextPage.setContent(pageFactory.nextPage())
prevPage.setContent(pageFactory.previousPage())
}
}
}

Loading…
Cancel
Save