Horis 3 лет назад
Родитель
Сommit
302cc84c5f

+ 1 - 1
app/src/main/java/io/legado/app/data/entities/SearchBook.kt

@@ -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
     }
 }

+ 1 - 1
app/src/main/java/io/legado/app/model/webBook/BookList.kt

@@ -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

+ 4 - 4
app/src/main/java/io/legado/app/ui/book/changesource/ChangeBookSourceViewModel.kt

@@ -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