From a17cd1fb7b58b10ecd5c93b5b4fcfc8e7a5a7d13 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 28 Feb 2020 14:46:34 +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 --- .../main/java/io/legado/app/ui/book/read/ReadBookActivity.kt | 2 +- .../java/io/legado/app/ui/book/read/page/ContentTextView.kt | 1 + .../main/java/io/legado/app/ui/book/read/page/PageView.kt | 5 ----- .../io/legado/app/ui/book/read/page/delegate/PageDelegate.kt | 4 ---- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 0f08df7c0..48bdd6cf6 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -691,7 +691,7 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo upScreenTimeOut() } observeEvent(PreferKey.textSelectAble) { - page_view.upSelectAble(it) + page_view.curPage.upSelectAble(it) } } 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 1bd474c89..d17e55a67 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 @@ -197,6 +197,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at y: Float, select: (relativePage: Int, lineIndex: Int, charIndex: Int) -> Unit ) { + if (!selectAble) return if (!visibleRect.contains(x, y)) return var relativeOffset = relativeOffset(0) for ((lineIndex, textLine) in textPage.textLines.withIndex()) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt index 52acc8195..1482d309a 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt @@ -132,11 +132,6 @@ class PageView(context: Context, attrs: AttributeSet) : } } - fun upSelectAble(selectAble: Boolean) { - pageDelegate?.upSelectAble(selectAble) - curPage.upSelectAble(selectAble) - } - fun upStyle() { ChapterProvider.upStyle() curPage.upStyle() 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 c710367c7..2b26714c4 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 @@ -101,10 +101,6 @@ abstract class PageDelegate(protected val pageView: PageView) : onScroll() } - fun upSelectAble(selectAble: Boolean) { - detector.setIsLongpressEnabled(selectAble) - } - open fun fling( startX: Int, startY: Int, velocityX: Int, velocityY: Int, minX: Int, maxX: Int, minY: Int, maxY: Int