Horis пре 3 година
родитељ
комит
e42e877a16

+ 8 - 9
app/src/main/java/io/legado/app/ui/book/read/page/entities/TextParagraph.kt

@@ -1,18 +1,17 @@
 package io.legado.app.ui.book.read.page.entities
 
-@Suppress("unused")
+@Suppress("unused", "MemberVisibilityCanBePrivate")
 data class TextParagraph(
     var num: Int,
     val textLines: ArrayList<TextLine> = arrayListOf(),
-) : Iterable<TextLine> {
+) {
     val text: String get() = textLines.joinToString("") { it.text }
     val length: Int get() = text.length
-    val chapterIndices: IntRange get() = first().chapterPosition..last().chapterPosition + last().charSize
-    val chapterPosition: Int get() = first().chapterPosition
-    val realNum: Int get() = first().paragraphNum
-    val isParagraphEnd: Boolean get() = last().isParagraphEnd
+    val firstLine: TextLine get() = textLines.first()
+    val lastLine: TextLine get() = textLines.last()
+    val chapterIndices: IntRange get() = firstLine.chapterPosition..lastLine.chapterPosition + lastLine.charSize
+    val chapterPosition: Int get() = firstLine.chapterPosition
+    val realNum: Int get() = firstLine.paragraphNum
+    val isParagraphEnd: Boolean get() = lastLine.isParagraphEnd
 
-    override fun iterator(): Iterator<TextLine> {
-        return textLines.iterator()
-    }
 }