This commit is contained in:
Horis 2023-11-05 11:42:54 +08:00
parent a7217886f6
commit 0d24d1bde8
3 changed files with 6 additions and 6 deletions

View File

@ -116,6 +116,6 @@ data class SearchBook(
variable = variable
).apply {
this.infoHtml = this@SearchBook.infoHtml
this.tocUrl = this@SearchBook.tocUrl
this.tocHtml = this@SearchBook.tocHtml
}
}

View File

@ -138,7 +138,7 @@ object BookList {
variable: String?
): SearchBook? {
val book = Book(variable = variable)
book.bookUrl = analyzeUrl.ruleUrl
book.bookUrl = NetworkUtils.getAbsoluteURL(analyzeUrl.url, analyzeUrl.ruleUrl)
book.origin = bookSource.bookSourceUrl
book.originName = bookSource.bookSourceName
book.originOrder = bookSource.customOrder

View File

@ -118,7 +118,7 @@ open class ChangeBookSourceViewModel(application: Application) : BaseViewModel(a
}.flowOn(IO)
@Volatile
private var searchIndex = 0
private var searchIndex = -1
override fun onCleared() {
super.onCleared()
@ -142,7 +142,7 @@ open class ChangeBookSourceViewModel(application: Application) : BaseViewModel(a
private fun initSearchPool() {
searchPool = Executors
.newFixedThreadPool(min(threadCount, AppConst.MAX_THREAD)).asCoroutineDispatcher()
searchIndex = 0
searchIndex = -1
}
fun refresh(): Boolean {
@ -195,10 +195,10 @@ open class ChangeBookSourceViewModel(application: Application) : BaseViewModel(a
private fun search() {
val searchIndex = synchronized(this) {
if (searchIndex > bookSourceList.lastIndex) {
if (searchIndex >= bookSourceList.lastIndex) {
return
}
searchIndex++
++searchIndex
}
val source = bookSourceList[searchIndex]
bookSourceList[searchIndex] = emptyBookSource