From 1876c6f61216edfe930f4c8d4c3b83b60f9ec2d0 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 31 Jul 2019 10:40:34 +0800 Subject: [PATCH 1/2] up --- .../java/io/legado/app/model/webbook/SourceDebug.kt | 11 +++++++++++ .../legado/app/ui/sourcedebug/SourceDebugActivity.kt | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt b/app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt index aef04abb1..2155cf3c5 100644 --- a/app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt +++ b/app/src/main/java/io/legado/app/model/webbook/SourceDebug.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 + } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt b/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt index be5966534..641aec977 100644 --- a/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt +++ b/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt @@ -78,12 +78,12 @@ class SourceDebugActivity : BaseActivity(), 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(), 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() } From 82e4f881e3778bff5bd77d6b35904222eb201da3 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 31 Jul 2019 10:44:48 +0800 Subject: [PATCH 2/2] up --- .../java/io/legado/app/ui/sourcedebug/SourceDebugModel.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugModel.kt b/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugModel.kt index fe3316548..e7a9c920f 100644 --- a/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugModel.kt +++ b/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugModel.kt @@ -34,12 +34,12 @@ class SourceDebugModel(application: Application) : BaseViewModel(application), S 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) } } ?: error?.let { it() }