From 9d4d105c2ad5390944ef762a8188f85d688aece7 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 25 Aug 2021 18:42:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/help/{storage => }/BookSourceAnalyzer.kt | 10 +++++----- .../java/io/legado/app/help/storage/ImportOldData.kt | 1 + .../java/io/legado/app/service/BaseReadAloudService.kt | 2 +- .../app/ui/association/ImportBookSourceViewModel.kt | 2 +- .../app/ui/book/source/edit/BookSourceEditViewModel.kt | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) rename app/src/main/java/io/legado/app/help/{storage => }/BookSourceAnalyzer.kt (98%) diff --git a/app/src/main/java/io/legado/app/help/storage/BookSourceAnalyzer.kt b/app/src/main/java/io/legado/app/help/BookSourceAnalyzer.kt similarity index 98% rename from app/src/main/java/io/legado/app/help/storage/BookSourceAnalyzer.kt rename to app/src/main/java/io/legado/app/help/BookSourceAnalyzer.kt index 42911a02e..886df3494 100644 --- a/app/src/main/java/io/legado/app/help/storage/BookSourceAnalyzer.kt +++ b/app/src/main/java/io/legado/app/help/BookSourceAnalyzer.kt @@ -1,4 +1,4 @@ -package io.legado.app.help.storage +package io.legado.app.help import androidx.annotation.Keep import com.jayway.jsonpath.JsonPath @@ -100,10 +100,10 @@ object BookSourceAnalyzer { source.enabled = sourceAny.enabled source.enabledExplore = sourceAny.enabledExplore source.header = sourceAny.header - source.loginUrl = if (sourceAny.loginUrl is String) { - sourceAny.loginUrl.toString() - } else { - JsonPath.parse(sourceAny.loginUrl).readString("url") + source.loginUrl = when (sourceAny.loginUrl) { + null -> null + is String -> sourceAny.loginUrl.toString() + else -> JsonPath.parse(sourceAny.loginUrl).readString("url") } source.loginUi = sourceAny.loginUi source.loginCheckJs = sourceAny.loginCheckJs diff --git a/app/src/main/java/io/legado/app/help/storage/ImportOldData.kt b/app/src/main/java/io/legado/app/help/storage/ImportOldData.kt index 5674d6230..e27eaf708 100644 --- a/app/src/main/java/io/legado/app/help/storage/ImportOldData.kt +++ b/app/src/main/java/io/legado/app/help/storage/ImportOldData.kt @@ -5,6 +5,7 @@ import android.net.Uri import androidx.documentfile.provider.DocumentFile import io.legado.app.data.appDb import io.legado.app.data.entities.BookSource +import io.legado.app.help.BookSourceAnalyzer import io.legado.app.utils.DocumentUtils import io.legado.app.utils.FileUtils import io.legado.app.utils.isContentScheme diff --git a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt index 67018e763..7f50e1546 100644 --- a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt @@ -198,9 +198,9 @@ abstract class BaseReadAloudService : BaseService(), } private fun startDs() { - handler.removeCallbacks(dsRunnable) postEvent(EventBus.TTS_DS, timeMinute) upNotification() + handler.removeCallbacks(dsRunnable) handler.postDelayed(dsRunnable, 60000) } diff --git a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt index 9519fab1a..06f865397 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt @@ -9,12 +9,12 @@ import io.legado.app.constant.AppPattern import io.legado.app.data.appDb import io.legado.app.data.entities.BookSource import io.legado.app.help.AppConfig +import io.legado.app.help.BookSourceAnalyzer import io.legado.app.help.ContentProcessor import io.legado.app.help.SourceHelp import io.legado.app.help.http.newCall import io.legado.app.help.http.okHttpClient import io.legado.app.help.http.text -import io.legado.app.help.storage.BookSourceAnalyzer import io.legado.app.help.storage.Restore import io.legado.app.utils.isAbsUrl import io.legado.app.utils.isJsonArray diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditViewModel.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditViewModel.kt index 02ec6052e..c56c74527 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditViewModel.kt @@ -5,9 +5,9 @@ import android.content.Intent import io.legado.app.base.BaseViewModel import io.legado.app.data.appDb import io.legado.app.data.entities.BookSource +import io.legado.app.help.BookSourceAnalyzer import io.legado.app.help.http.newCallStrResponse import io.legado.app.help.http.okHttpClient -import io.legado.app.help.storage.BookSourceAnalyzer import io.legado.app.help.storage.Restore import io.legado.app.utils.* import kotlinx.coroutines.Dispatchers