|
|
@ -263,9 +263,10 @@ object ReadBook { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun download(chapter: BookChapter, resetPageOffset: Boolean) { |
|
|
|
private fun download(chapter: BookChapter, resetPageOffset: Boolean) { |
|
|
|
book?.let { book -> |
|
|
|
val book = book |
|
|
|
webBook?.let { |
|
|
|
val webBook = webBook |
|
|
|
it.getContent(book, chapter) |
|
|
|
if (book != null && webBook != null) { |
|
|
|
|
|
|
|
webBook.getContent(book, chapter) |
|
|
|
.onSuccess(Dispatchers.IO) { content -> |
|
|
|
.onSuccess(Dispatchers.IO) { content -> |
|
|
|
if (content.isEmpty()) { |
|
|
|
if (content.isEmpty()) { |
|
|
|
contentLoadFinish( |
|
|
|
contentLoadFinish( |
|
|
@ -294,7 +295,7 @@ object ReadBook { |
|
|
|
) |
|
|
|
) |
|
|
|
removeLoading(chapter.index) |
|
|
|
removeLoading(chapter.index) |
|
|
|
} |
|
|
|
} |
|
|
|
} ?: let { |
|
|
|
} else if (book != null) { |
|
|
|
contentLoadFinish( |
|
|
|
contentLoadFinish( |
|
|
|
book, |
|
|
|
book, |
|
|
|
chapter, |
|
|
|
chapter, |
|
|
@ -302,8 +303,9 @@ object ReadBook { |
|
|
|
resetPageOffset = resetPageOffset |
|
|
|
resetPageOffset = resetPageOffset |
|
|
|
) |
|
|
|
) |
|
|
|
removeLoading(chapter.index) |
|
|
|
removeLoading(chapter.index) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
removeLoading(chapter.index) |
|
|
|
} |
|
|
|
} |
|
|
|
} ?: removeLoading(chapter.index) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun addLoading(index: Int): Boolean { |
|
|
|
private fun addLoading(index: Int): Boolean { |
|
|
|