优化
This commit is contained in:
@@ -1,18 +1,17 @@
|
|||||||
package io.legado.app.ui.book.read.page.entities
|
package io.legado.app.ui.book.read.page.entities
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused", "MemberVisibilityCanBePrivate")
|
||||||
data class TextParagraph(
|
data class TextParagraph(
|
||||||
var num: Int,
|
var num: Int,
|
||||||
val textLines: ArrayList<TextLine> = arrayListOf(),
|
val textLines: ArrayList<TextLine> = arrayListOf(),
|
||||||
) : Iterable<TextLine> {
|
) {
|
||||||
val text: String get() = textLines.joinToString("") { it.text }
|
val text: String get() = textLines.joinToString("") { it.text }
|
||||||
val length: Int get() = text.length
|
val length: Int get() = text.length
|
||||||
val chapterIndices: IntRange get() = first().chapterPosition..last().chapterPosition + last().charSize
|
val firstLine: TextLine get() = textLines.first()
|
||||||
val chapterPosition: Int get() = first().chapterPosition
|
val lastLine: TextLine get() = textLines.last()
|
||||||
val realNum: Int get() = first().paragraphNum
|
val chapterIndices: IntRange get() = firstLine.chapterPosition..lastLine.chapterPosition + lastLine.charSize
|
||||||
val isParagraphEnd: Boolean get() = last().isParagraphEnd
|
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()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user