pull/34/head
kunfei 5 years ago
parent 1b9449b622
commit a3a86fb044
  1. 7
      app/src/main/java/io/legado/app/ui/widget/page/delegate/PageDelegate.kt

@ -94,7 +94,7 @@ abstract class PageDelegate(protected val pageView: PageView) {
startY, startY,
dx, dx,
dy, dy,
getDuration((if (dx != 0) dx else dy).toFloat()) if (dx != 0) getDuration(dx, viewWidth) else getDuration(dy, viewHeight)
) )
isRunning = true isRunning = true
isStarted = true isStarted = true
@ -109,9 +109,8 @@ abstract class PageDelegate(protected val pageView: PageView) {
invalidate() invalidate()
} }
protected fun getDuration(distance: Float): Int { private fun getDuration(distance: Int, len: Int): Int {
val duration = 300 * abs(distance) / viewWidth return (300f * abs(distance) / len).toInt()
return duration.toInt()
} }
fun setViewSize(width: Int, height: Int) { fun setViewSize(width: Int, height: Int) {

Loading…
Cancel
Save