mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
优化
This commit is contained in:
parent
e001398e21
commit
ba60872e71
@ -74,13 +74,16 @@ class ExploreShowViewModel(application: Application) : BaseViewModel(application
|
|||||||
val url = exploreUrl
|
val url = exploreUrl
|
||||||
if (source == null || url == null) return emptyList()
|
if (source == null || url == null) return emptyList()
|
||||||
val searchBooks = arrayListOf<SearchBook>()
|
val searchBooks = arrayListOf<SearchBook>()
|
||||||
|
var reverse = false
|
||||||
val range = if (start <= end) {
|
val range = if (start <= end) {
|
||||||
start .. end
|
start .. end
|
||||||
} else {
|
} else {
|
||||||
|
reverse = true
|
||||||
start downTo end
|
start downTo end
|
||||||
}
|
}
|
||||||
for (page in range) {
|
for (page in range) {
|
||||||
val books = WebBook.exploreBookAwait(source, url, page)
|
val books = WebBook.exploreBookAwait(source, url, page)
|
||||||
|
if (reverse) books.reverse()
|
||||||
if (books.isEmpty()) break
|
if (books.isEmpty()) break
|
||||||
searchBooks.addAll(books)
|
searchBooks.addAll(books)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user