From 705004d878ef20a80f824f4c0b8edc511ddca10b Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 12 Nov 2019 16:56:21 +0800 Subject: [PATCH] up --- .../legado/app/model/webbook/SourceDebug.kt | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 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 2cc4dc8a3..807d1c12e 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 @@ -61,19 +61,23 @@ class SourceDebug(private val webBook: WebBook, callback: Callback) { fun startDebug(key: String) { cancelDebug() startTime = System.currentTimeMillis() - if (key.isAbsUrl()) { - val book = Book() - book.origin = webBook.sourceUrl - book.bookUrl = key - printLog(webBook.sourceUrl, "⇒开始访问详情页:$key") - infoDebug(book) - } else if (key.contains("::")) { - val url = key.substring(key.indexOf("::") + 2) - printLog(webBook.sourceUrl, "⇒开始访问发现页:$url") - exploreDebug(url) - } else { - printLog(webBook.sourceUrl, "⇒开始搜索关键字:$key") - searchDebug(key) + when { + key.isAbsUrl() -> { + val book = Book() + book.origin = webBook.sourceUrl + book.bookUrl = key + printLog(webBook.sourceUrl, "⇒开始访问详情页:$key") + infoDebug(book) + } + key.contains("::") -> { + val url = key.substring(key.indexOf("::") + 2) + printLog(webBook.sourceUrl, "⇒开始访问发现页:$url") + exploreDebug(url) + } + else -> { + printLog(webBook.sourceUrl, "⇒开始搜索关键字:$key") + searchDebug(key) + } } }