优化翻页动画

pull/981/head
gedoor 4 years ago
parent acbd2b11d1
commit 45b6f77eab
  1. 4
      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

@ -119,7 +119,7 @@ abstract class HorizontalPageDelegate(readView: ReadView) : PageDelegate(readVie
abortAnim() abortAnim()
if (!hasNext()) return if (!hasNext()) return
setDirection(PageDirection.NEXT) setDirection(PageDirection.NEXT)
readView.setTouchPoint(viewWidth.toFloat(), 0f, false) readView.setStartPoint(viewWidth.toFloat(), 0f, false)
onAnimStart(animationSpeed) onAnimStart(animationSpeed)
} }
@ -127,7 +127,7 @@ abstract class HorizontalPageDelegate(readView: ReadView) : PageDelegate(readVie
abortAnim() abortAnim()
if (!hasPrev()) return if (!hasPrev()) return
setDirection(PageDirection.PREV) setDirection(PageDirection.PREV)
readView.setTouchPoint(0f, 0f) readView.setStartPoint(0f, 0f, false)
onAnimStart(animationSpeed) onAnimStart(animationSpeed)
} }

@ -3,7 +3,7 @@ package io.legado.app.ui.book.read.page.delegate
import android.content.Context import android.content.Context
import android.graphics.Canvas import android.graphics.Canvas
import android.view.MotionEvent import android.view.MotionEvent
import android.view.animation.DecelerateInterpolator import android.view.animation.LinearInterpolator
import android.widget.Scroller import android.widget.Scroller
import androidx.annotation.CallSuper import androidx.annotation.CallSuper
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
@ -37,7 +37,7 @@ abstract class PageDelegate(protected val readView: ReadView) {
protected var viewHeight: Int = readView.height protected var viewHeight: Int = readView.height
protected val scroller: Scroller by lazy { protected val scroller: Scroller by lazy {
Scroller(readView.context, DecelerateInterpolator()) Scroller(readView.context, LinearInterpolator())
} }
private val snackBar: Snackbar by lazy { private val snackBar: Snackbar by lazy {

Loading…
Cancel
Save