优化翻页

pull/357/head
gedoor 4 years ago
parent b8c8a4465d
commit 50631cf480
  1. 1
      app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt
  2. 6
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt
  3. 4
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt
  4. 3
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt

@ -141,6 +141,7 @@ class PageView(context: Context, attrs: AttributeSet) :
pressDown = true
isMove = false
pageDelegate?.onTouch(event)
pageDelegate?.onDown()
setStartPoint(event.x, event.y)
}
MotionEvent.ACTION_MOVE -> {

@ -99,12 +99,12 @@ abstract class HorizontalPageDelegate(pageView: PageView) : PageDelegate(pageVie
}
override fun abortAnim() {
isStarted = false
isMoved = false
isRunning = false
if (!scroller.isFinished) {
pageView.isAbortAnim = true
scroller.abortAnimation()
isStarted = false
isMoved = false
isRunning = false
if (!isCancel) {
pageView.fillPage(mDirection)
pageView.invalidate()

@ -139,7 +139,7 @@ abstract class PageDelegate(protected val pageView: PageView) {
/**
* 按下
*/
fun onDown(): Boolean {
fun onDown() {
//是否移动
isMoved = false
//是否存在下一章
@ -150,8 +150,6 @@ abstract class PageDelegate(protected val pageView: PageView) {
isCancel = false
//是下一章还是前一章
setDirection(Direction.NONE)
//设置起始位置的触摸点
return true
}
/**

@ -85,6 +85,9 @@ class ScrollPageDelegate(pageView: PageView) : PageDelegate(pageView) {
}
override fun abortAnim() {
isStarted = false
isMoved = false
isRunning = false
if (!scroller.isFinished) {
pageView.isAbortAnim = true
scroller.abortAnimation()

Loading…
Cancel
Save