From 3d81ab4e26d99b78d467197eafabe21efd574dc8 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 9 Dec 2020 18:02:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=97=B6=E4=BC=98=E5=85=88=E9=80=89=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/read/page/PageView.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 402666168..041ce7025 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 @@ -259,7 +259,11 @@ class PageView(context: Context) : FrameLayout(context) { } fun selectStartMoveIndex(relativePage: Int, lineIndex: Int, charIndex: Int) { - binding.contentTextView.selectStartMoveIndex(relativePage, lineIndex, charIndex) + try { + binding.contentTextView.selectStartMoveIndex(relativePage, lineIndex, charIndex) + } catch (e: Exception) { + print("selectStartMoveIndex($relativePage, $lineIndex, $charIndex)") + } } fun selectEndMove(x: Float, y: Float) { @@ -267,7 +271,11 @@ class PageView(context: Context) : FrameLayout(context) { } fun selectEndMoveIndex(relativePage: Int, lineIndex: Int, charIndex: Int) { - binding.contentTextView.selectEndMoveIndex(relativePage, lineIndex, charIndex) + try { + binding.contentTextView.selectEndMoveIndex(relativePage, lineIndex, charIndex) + } catch (e: Exception) { + print("selectEndMoveIndex($relativePage, $lineIndex, $charIndex)") + } } fun cancelSelect() { From 2ad8492d1aef42c36150f3174a5b6f08f3d8e8c1 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 9 Dec 2020 18:04:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=97=B6=E4=BC=98=E5=85=88=E9=80=89=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/page/PageView.kt | 12 ++---------- .../io/legado/app/ui/book/read/page/ReadView.kt | 13 +++++++++++-- 2 files changed, 13 insertions(+), 12 deletions(-) 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 041ce7025..402666168 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 @@ -259,11 +259,7 @@ class PageView(context: Context) : FrameLayout(context) { } fun selectStartMoveIndex(relativePage: Int, lineIndex: Int, charIndex: Int) { - try { - binding.contentTextView.selectStartMoveIndex(relativePage, lineIndex, charIndex) - } catch (e: Exception) { - print("selectStartMoveIndex($relativePage, $lineIndex, $charIndex)") - } + binding.contentTextView.selectStartMoveIndex(relativePage, lineIndex, charIndex) } fun selectEndMove(x: Float, y: Float) { @@ -271,11 +267,7 @@ class PageView(context: Context) : FrameLayout(context) { } fun selectEndMoveIndex(relativePage: Int, lineIndex: Int, charIndex: Int) { - try { - binding.contentTextView.selectEndMoveIndex(relativePage, lineIndex, charIndex) - } catch (e: Exception) { - print("selectEndMoveIndex($relativePage, $lineIndex, $charIndex)") - } + binding.contentTextView.selectEndMoveIndex(relativePage, lineIndex, charIndex) } fun cancelSelect() { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt index c2de83697..01578df2d 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt @@ -338,8 +338,17 @@ class ReadView(context: Context, attrs: AttributeSet) : } end -= 1 } - curPage.selectStartMoveIndex(firstRelativePage, lineStart, start) - curPage.selectEndMoveIndex(firstRelativePage, lineEnd, end) + try { + curPage.selectStartMoveIndex(firstRelativePage, lineStart, start) + curPage.selectEndMoveIndex(firstRelativePage, lineEnd, end) + } catch (e: Exception) { + print( + """ + curPage.selectStartMoveIndex($firstRelativePage, $lineStart, $start) + curPage.selectEndMoveIndex($firstRelativePage, $lineEnd, $end) + """.trimIndent() + ) + } } }