From 9d3d4824e78d19bd4bb414a931f7f4a52e1f9cb7 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 2 Apr 2021 23:07:08 +0800 Subject: [PATCH] =?UTF-8?q?debug=E6=B7=BB=E5=8A=A0=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E6=BA=90=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/model/webBook/BookChapterList.kt | 2 +- .../io/legado/app/model/webBook/BookContent.kt | 1 + .../java/io/legado/app/model/webBook/BookInfo.kt | 1 + .../java/io/legado/app/model/webBook/BookList.kt | 1 + .../book/source/debug/BookSourceDebugActivity.kt | 14 ++++++++++++-- .../ui/book/source/debug/BookSourceDebugModel.kt | 15 ++++++++++++--- 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt b/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt index 2e7ebfb38..0867fd95e 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt @@ -32,7 +32,7 @@ object BookChapterList { appCtx.getString(R.string.error_get_web_content, baseUrl) ) Debug.log(bookSource.bookSourceUrl, "≡获取成功:${baseUrl}") - + Debug.log(bookSource.bookSourceUrl, body, state = 30) val tocRule = bookSource.getTocRule() val nextUrlList = arrayListOf(baseUrl) var reverse = false diff --git a/app/src/main/java/io/legado/app/model/webBook/BookContent.kt b/app/src/main/java/io/legado/app/model/webBook/BookContent.kt index 574a9acdf..8eef8d50b 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookContent.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookContent.kt @@ -33,6 +33,7 @@ object BookContent { appCtx.getString(R.string.error_get_web_content, baseUrl) ) Debug.log(bookSource.bookSourceUrl, "≡获取成功:${baseUrl}") + Debug.log(bookSource.bookSourceUrl, body, state = 40) val mNextChapterUrl = if (!nextChapterUrl.isNullOrEmpty()) { nextChapterUrl } else { diff --git a/app/src/main/java/io/legado/app/model/webBook/BookInfo.kt b/app/src/main/java/io/legado/app/model/webBook/BookInfo.kt index 5bd30e2b3..bb3e99a39 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookInfo.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookInfo.kt @@ -29,6 +29,7 @@ object BookInfo { appCtx.getString(R.string.error_get_web_content, baseUrl) ) Debug.log(bookSource.bookSourceUrl, "≡获取成功:${baseUrl}") + Debug.log(bookSource.bookSourceUrl, body, state = 20) val analyzeRule = AnalyzeRule(book) analyzeRule.setContent(body).setBaseUrl(baseUrl) analyzeRule.setRedirectUrl(redirectUrl) diff --git a/app/src/main/java/io/legado/app/model/webBook/BookList.kt b/app/src/main/java/io/legado/app/model/webBook/BookList.kt index c24192ab2..64c0618d9 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookList.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookList.kt @@ -36,6 +36,7 @@ object BookList { ) ) Debug.log(bookSource.bookSourceUrl, "≡获取成功:${analyzeUrl.ruleUrl}") + Debug.log(bookSource.bookSourceUrl, body, state = 10) val analyzeRule = AnalyzeRule(variableBook) analyzeRule.setContent(body).setBaseUrl(baseUrl) analyzeRule.setRedirectUrl(baseUrl) diff --git a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt index 977502eba..ffb21b7bf 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt @@ -96,8 +96,18 @@ class BookSourceDebugActivity : VMBaseActivity { - qrCodeResult.launch(null) + R.id.menu_scan -> qrCodeResult.launch(null) + R.id.menu_search_src -> { + + } + R.id.menu_book_src -> { + + } + R.id.menu_toc_src -> { + + } + R.id.menu_content_src -> { + } R.id.menu_help -> showHelp() } diff --git a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugModel.kt b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugModel.kt index 3ce462f24..43e969e97 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugModel.kt @@ -10,8 +10,11 @@ class BookSourceDebugModel(application: Application) : BaseViewModel(application Debug.Callback { private var webBook: WebBook? = null - - private var callback: ((Int, String)-> Unit)? = null + private var callback: ((Int, String) -> Unit)? = null + var searchSrc: String? = null + var bookSrc: String? = null + var tocSrc: String? = null + var contentSrc: String? = null fun init(sourceUrl: String?) { sourceUrl?.let { @@ -39,7 +42,13 @@ class BookSourceDebugModel(application: Application) : BaseViewModel(application } override fun printLog(state: Int, msg: String) { - callback?.invoke(state, msg) + when (state) { + 10 -> searchSrc = msg + 20 -> bookSrc = msg + 30 -> tocSrc = msg + 40 -> contentSrc = msg + else -> callback?.invoke(state, msg) + } } override fun onCleared() {