feat: 优化代码

pull/115/head
kunfei 5 years ago
parent bcc8377f7d
commit a9eadf79f8
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt
  3. 6
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt

@ -458,7 +458,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
*/ */
override fun upContent(relativePosition: Int, resetScrollOffset: Boolean) { override fun upContent(relativePosition: Int, resetScrollOffset: Boolean) {
launch { launch {
page_view.upContent(relativePosition) page_view.upContent(relativePosition, resetScrollOffset)
} }
} }

@ -180,11 +180,11 @@ abstract class PageDelegate(protected val pageView: PageView) :
onAnimStart() onAnimStart()
} }
abstract fun onAnimStart()//scroller start open fun onAnimStart() {}//scroller start
open fun onDraw(canvas: Canvas) {}//绘制 open fun onDraw(canvas: Canvas) {}//绘制
abstract fun onAnimStop()//scroller finish open fun onAnimStop() {}//scroller finish
open fun onScroll() {}//移动contentView, slidePage open fun onScroll() {}//移动contentView, slidePage

@ -24,12 +24,6 @@ class ScrollPageDelegate(pageView: PageView) : PageDelegate(pageView) {
curPage.onScroll(touchY - lastY) curPage.onScroll(touchY - lastY)
} }
override fun onAnimStop() {
if (!isCancel) {
pageView.fillPage(mDirection)
}
}
override fun onTouch(event: MotionEvent): Boolean { override fun onTouch(event: MotionEvent): Boolean {
if (event.action == MotionEvent.ACTION_DOWN) { if (event.action == MotionEvent.ACTION_DOWN) {
setStartPoint(event.x, event.y) setStartPoint(event.x, event.y)

Loading…
Cancel
Save