pull/32/head
kunfei 5 years ago
parent d14edecc1a
commit 43f43ca31b
  1. 6
      app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt
  2. 10
      app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt

@ -9,7 +9,7 @@ import io.legado.app.utils.htmlFormat
import java.text.SimpleDateFormat
import java.util.*
class SourceDebug(val webBook: WebBook) {
class SourceDebug(private val webBook: WebBook, callback: Callback) {
companion object {
var debugSource: String? = null
@ -35,6 +35,10 @@ class SourceDebug(val webBook: WebBook) {
fun printLog(state: Int, msg: String)
}
init {
SourceDebug.callback = callback
}
fun searchDebug(key: String) {
webBook.searchBook(key, 1)
.onSuccess { searchBooks ->

@ -19,7 +19,8 @@ import kotlinx.android.synthetic.main.view_title_bar.*
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch
class SourceDebugActivity : BaseActivity<AndroidViewModel>() {
class SourceDebugActivity : BaseActivity<AndroidViewModel>(), SourceDebug.Callback {
override val viewModel: AndroidViewModel
get() = getViewModel(AndroidViewModel::class.java)
override val layoutID: Int
@ -70,13 +71,16 @@ class SourceDebugActivity : BaseActivity<AndroidViewModel>() {
val book = Book()
book.origin = it.bookSourceUrl
book.bookUrl = key
SourceDebug(WebBook(it))
SourceDebug(WebBook(it), this)
.infoDebug(book)
} else {
SourceDebug(WebBook(it))
SourceDebug(WebBook(it), this)
.searchDebug(key)
}
}
}
override fun printLog(state: Int, msg: String) {
adapter.logList.add(msg)
}
}
Loading…
Cancel
Save