feat: 优化代码

pull/198/head
kunfei 5 years ago
parent 2f6ccce755
commit 5aef21c3b5
  1. 5
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt

@ -37,7 +37,10 @@ abstract class HorizontalPageDelegate(pageView: PageView) : PageDelegate(pageVie
override fun onTouch(event: MotionEvent) { override fun onTouch(event: MotionEvent) {
when (event.action) { when (event.action) {
MotionEvent.ACTION_DOWN -> { MotionEvent.ACTION_DOWN -> {
abort() if (abort()) {
onAnimStop()
stopScroll()
}
} }
MotionEvent.ACTION_MOVE -> { MotionEvent.ACTION_MOVE -> {
if (isTextSelected) { if (isTextSelected) {

@ -154,10 +154,12 @@ abstract class PageDelegate(protected val pageView: PageView) :
} }
} }
fun abort() { fun abort(): Boolean {
if (!scroller.isFinished) { if (!scroller.isFinished) {
scroller.abortAnimation() scroller.abortAnimation()
return true
} }
return false
} }
open fun onAnimStart() {}//scroller start open fun onAnimStart() {}//scroller start

Loading…
Cancel
Save