feat: 优化代码

pull/111/head
kunfei 5 years ago
parent 577bd6a83b
commit 0f88499063
  1. 8
      app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt
  2. 9
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt

@ -1,11 +1,9 @@
package io.legado.app.ui.book.read.page
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import io.legado.app.R
import io.legado.app.constant.PreferKey
@ -51,12 +49,6 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
}
}
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent?): Boolean {
return true
}
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
textPage?.let { textPage ->

@ -211,7 +211,6 @@ abstract class PageDelegate(protected val pageView: PageView) :
@CallSuper
open fun onTouch(event: MotionEvent): Boolean {
if (isStarted) return false
curPage.dispatchTouchEvent(event)
return detector.onTouchEvent(event)
}
@ -222,7 +221,6 @@ abstract class PageDelegate(protected val pageView: PageView) :
if (isTextSelected) {
curPage.cancelSelect()
}
// abort()
//是否移动
isMoved = false
//是否存在下一章
@ -242,6 +240,10 @@ abstract class PageDelegate(protected val pageView: PageView) :
* 单击
*/
override fun onSingleTapUp(e: MotionEvent): Boolean {
if (isTextSelected) {
isTextSelected = false
return true
}
val x = e.x
val y = e.y
if (centerRectF.contains(x, y)) {
@ -290,6 +292,9 @@ abstract class PageDelegate(protected val pageView: PageView) :
velocityX: Float,
velocityY: Float
): Boolean {
if (isTextSelected) {
isTextSelected = false
}
if (!noNext) onAnimStart()
return true
}

Loading…
Cancel
Save