pull/32/head
kunfei 5 years ago
parent 55857cce15
commit 1876c6f612
  1. 11
      app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt
  2. 6
      app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt

@ -88,4 +88,15 @@ class SourceDebug(private val webBook: WebBook, callback: Callback) {
printLog(debugSource, -1, it.localizedMessage)
}
}
fun printLog(
sourceUrl: String?,
state: Int,
msg: String,
print: Boolean = true,
isHtml: Boolean = false
): SourceDebug {
SourceDebug.printLog(sourceUrl, state, msg, print, isHtml)
return this
}
}

@ -78,12 +78,12 @@ class SourceDebugActivity : BaseActivity<AndroidViewModel>(), SourceDebug.Callba
val book = Book()
book.origin = it.bookSourceUrl
book.bookUrl = key
SourceDebug.printLog(it.bookSourceUrl, 1, "开始访问$key")
SourceDebug(WebBook(it), this)
.printLog(it.bookSourceUrl, 1, "开始访问$key")
.infoDebug(book)
} else {
SourceDebug.printLog(it.bookSourceUrl, 1, "开始搜索关键字$key")
SourceDebug(WebBook(it), this)
.printLog(it.bookSourceUrl, 1, "开始搜索关键字$key")
.searchDebug(key)
}
} ?: toast("未获取到书源")
@ -93,7 +93,7 @@ class SourceDebugActivity : BaseActivity<AndroidViewModel>(), SourceDebug.Callba
launch {
synchronized(this) {
adapter.logList.add(msg)
adapter.notifyItemChanged(adapter.logList.size - 1)
adapter.notifyItemInserted(adapter.logList.size - 1)
if (state == -1 || state == 1000) {
rotate_loading.hide()
}

Loading…
Cancel
Save