优化
This commit is contained in:
@@ -665,7 +665,7 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
|||||||
val line = page.lines.first()
|
val line = page.lines.first()
|
||||||
val durChapterPos = ReadBook.durChapterPos
|
val durChapterPos = ReadBook.durChapterPos
|
||||||
val startPos = line.chapterPosition
|
val startPos = line.chapterPosition
|
||||||
val endPos = line.chapterPosition + line.charSize
|
val endPos = startPos + line.charSize
|
||||||
if (durChapterPos in startPos..<endPos) {
|
if (durChapterPos in startPos..<endPos) {
|
||||||
post {
|
post {
|
||||||
upContent(resetPageOffset = false)
|
upContent(resetPageOffset = false)
|
||||||
|
|||||||
@@ -267,6 +267,8 @@ data class TextChapter(
|
|||||||
fun setProgressListener(l: LayoutProgressListener) {
|
fun setProgressListener(l: LayoutProgressListener) {
|
||||||
if (isCompleted) {
|
if (isCompleted) {
|
||||||
l.onLayoutCompleted()
|
l.onLayoutCompleted()
|
||||||
|
} else if (layout?.exception != null) {
|
||||||
|
l.onLayoutException(layout?.exception!!)
|
||||||
} else {
|
} else {
|
||||||
listener = l
|
listener = l
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,12 +66,12 @@ class TextChapterLayout(
|
|||||||
private val stringBuilder = StringBuilder()
|
private val stringBuilder = StringBuilder()
|
||||||
|
|
||||||
private var isCompleted = false
|
private var isCompleted = false
|
||||||
private var exception: Throwable? = null
|
|
||||||
private val job: Coroutine<*>
|
private val job: Coroutine<*>
|
||||||
private val bookChapter inline get() = textChapter.chapter
|
private val bookChapter inline get() = textChapter.chapter
|
||||||
private val displayTitle inline get() = textChapter.title
|
private val displayTitle inline get() = textChapter.title
|
||||||
private val chaptersSize inline get() = textChapter.chaptersSize
|
private val chaptersSize inline get() = textChapter.chaptersSize
|
||||||
|
|
||||||
|
var exception: Throwable? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
job = Coroutine.async(scope) {
|
job = Coroutine.async(scope) {
|
||||||
|
|||||||
Reference in New Issue
Block a user