feat: 优化代码

pull/141/head
kunfei 5 years ago
parent 6fb51b0eea
commit 805cc907e2
  1. 11
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/NoAnimPageDelegate.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt

@ -1,19 +1,14 @@
package io.legado.app.ui.book.read.page.delegate package io.legado.app.ui.book.read.page.delegate
import android.graphics.Canvas
import io.legado.app.ui.book.read.page.PageView import io.legado.app.ui.book.read.page.PageView
class NoAnimPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageView) { class NoAnimPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageView) {
override fun onAnimStart() {
startScroll(touchX.toInt(), 0, 0, 0)
}
override fun onDraw(canvas: Canvas) {
}
override fun onAnimStop() { override fun onAnimStart() {
if (!isCancel) { if (!isCancel) {
pageView.fillPage(mDirection) pageView.fillPage(mDirection)
} }
stopScroll()
} }
} }

@ -126,7 +126,7 @@ abstract class PageDelegate(protected val pageView: PageView) :
pageView.invalidate() pageView.invalidate()
} }
private fun stopScroll() { protected fun stopScroll() {
isStarted = false isStarted = false
pageView.post { pageView.post {
isMoved = false isMoved = false

Loading…
Cancel
Save