Horis 2 лет назад
Родитель
Сommit
1b47797160

+ 3 - 0
app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt

@@ -536,6 +536,9 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
     }
 
     private fun upSelectChars() {
+        if (!selectStart.isSelected() || !selectEnd.isSelected()) {
+            return
+        }
         val last = if (callBack.isScroll) 2 else 0
         val textPos = TextPos(0, 0, 0)
         for (relativePos in 0..last) {

+ 1 - 0
app/src/main/java/io/legado/app/ui/book/read/page/entities/TextChapter.kt

@@ -104,6 +104,7 @@ data class TextChapter(
      * @return 已读长度
      */
     fun getReadLength(pageIndex: Int): Int {
+        if (pageIndex < 0) return 0
         return pages[min(pageIndex, lastIndex)].lines.first().chapterPosition
         /*
         var length = 0

+ 4 - 0
app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPos.kt

@@ -69,4 +69,8 @@ data class TextPos(
         isLast = false
     }
 
+    fun isSelected(): Boolean {
+        return lineIndex >= 0 && columnIndex >= 0
+    }
+
 }