From 0f8849906317376653728b570ef913bc7a4b5996 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 22 Feb 2020 08:09:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/page/ContentTextView.kt | 8 -------- .../app/ui/book/read/page/delegate/PageDelegate.kt | 9 +++++++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt index 05fb0a0a1..1265c3ec2 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.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 -> diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt index abc953046..4cb163900 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt @@ -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 }