From 2b4e0637bc22e87d1a41ed35a4447a541340ffa2 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 17 Mar 2022 14:52:36 +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/exception/ConcurrentException.kt | 8 +++++ .../app/exception/ContentEmptyException.kt | 6 ++++ .../app/exception/NoStackTraceException.kt | 12 ++++++++ .../legado/app/exception/TocEmptyException.kt | 6 ++++ .../main/java/io/legado/app/help/AppUpdate.kt | 2 +- .../io/legado/app/help/DirectLinkUpload.kt | 2 +- .../legado/app/help/config/ReadBookConfig.kt | 2 +- .../app/help/glide/OkHttpStreamFetcher.kt | 2 +- .../legado/app/help/http/BackstageWebView.kt | 2 +- .../io/legado/app/help/storage/AppWebDav.kt | 2 +- .../java/io/legado/app/model/CacheBook.kt | 1 + .../java/io/legado/app/model/Exceptions.kt | 29 ------------------- .../app/model/analyzeRule/AnalyzeUrl.kt | 2 +- .../legado/app/model/localBook/LocalBook.kt | 2 +- .../legado/app/model/rss/RssParserByRule.kt | 2 +- .../app/model/webBook/BookChapterList.kt | 4 +-- .../legado/app/model/webBook/BookContent.kt | 4 +-- .../io/legado/app/model/webBook/BookInfo.kt | 2 +- .../io/legado/app/model/webBook/BookList.kt | 2 +- .../io/legado/app/model/webBook/WebBook.kt | 2 +- .../legado/app/service/CheckSourceService.kt | 10 +++++-- .../app/service/HttpReadAloudService.kt | 4 +-- .../legado/app/service/TTSReadAloudService.kt | 2 +- .../association/BaseAssociationViewModel.kt | 2 +- .../association/FileAssociationViewModel.kt | 2 +- .../association/ImportBookSourceViewModel.kt | 2 +- .../association/ImportRssSourceViewModel.kt | 2 +- .../app/ui/book/cache/CacheViewModel.kt | 2 +- .../ChangeChapterSourceViewModel.kt | 3 +- .../app/ui/book/info/BookInfoViewModel.kt | 2 +- .../app/ui/book/read/ReadBookActivity.kt | 2 +- .../app/ui/book/read/ReadBookViewModel.kt | 2 +- .../book/read/config/HttpTtsEditViewModel.kt | 2 +- .../book/read/config/SpeakEngineViewModel.kt | 2 +- .../source/edit/BookSourceEditViewModel.kt | 2 +- .../io/legado/app/ui/browser/WebViewModel.kt | 3 +- .../app/ui/login/SourceLoginViewModel.kt | 2 +- .../ui/main/bookshelf/BookshelfViewModel.kt | 2 +- .../io/legado/app/utils/DocumentExtensions.kt | 2 +- .../java/io/legado/app/utils/UriExtensions.kt | 3 +- 40 files changed, 76 insertions(+), 71 deletions(-) create mode 100644 app/src/main/java/io/legado/app/exception/ConcurrentException.kt create mode 100644 app/src/main/java/io/legado/app/exception/ContentEmptyException.kt create mode 100644 app/src/main/java/io/legado/app/exception/NoStackTraceException.kt create mode 100644 app/src/main/java/io/legado/app/exception/TocEmptyException.kt delete mode 100644 app/src/main/java/io/legado/app/model/Exceptions.kt diff --git a/app/src/main/java/io/legado/app/exception/ConcurrentException.kt b/app/src/main/java/io/legado/app/exception/ConcurrentException.kt new file mode 100644 index 000000000..0ec3d6cca --- /dev/null +++ b/app/src/main/java/io/legado/app/exception/ConcurrentException.kt @@ -0,0 +1,8 @@ +@file:Suppress("unused") + +package io.legado.app.exception + +/** + * 并发限制 + */ +class ConcurrentException(msg: String, val waitTime: Int) : NoStackTraceException(msg) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/exception/ContentEmptyException.kt b/app/src/main/java/io/legado/app/exception/ContentEmptyException.kt new file mode 100644 index 000000000..cf8ad3067 --- /dev/null +++ b/app/src/main/java/io/legado/app/exception/ContentEmptyException.kt @@ -0,0 +1,6 @@ +package io.legado.app.exception + +/** + * 内容为空 + */ +class ContentEmptyException(msg: String) : NoStackTraceException(msg) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/exception/NoStackTraceException.kt b/app/src/main/java/io/legado/app/exception/NoStackTraceException.kt new file mode 100644 index 000000000..8ff88a6f2 --- /dev/null +++ b/app/src/main/java/io/legado/app/exception/NoStackTraceException.kt @@ -0,0 +1,12 @@ +package io.legado.app.exception + +/** + * 不记录错误堆栈的报错 + */ +open class NoStackTraceException(msg: String) : Exception(msg) { + + override fun fillInStackTrace(): Throwable { + return this + } + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/exception/TocEmptyException.kt b/app/src/main/java/io/legado/app/exception/TocEmptyException.kt new file mode 100644 index 000000000..d0b7a8d79 --- /dev/null +++ b/app/src/main/java/io/legado/app/exception/TocEmptyException.kt @@ -0,0 +1,6 @@ +package io.legado.app.exception + +/** + * 目录为空 + */ +class TocEmptyException(msg: String) : NoStackTraceException(msg) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/help/AppUpdate.kt b/app/src/main/java/io/legado/app/help/AppUpdate.kt index 66aa2983a..cb21c55e9 100644 --- a/app/src/main/java/io/legado/app/help/AppUpdate.kt +++ b/app/src/main/java/io/legado/app/help/AppUpdate.kt @@ -2,10 +2,10 @@ package io.legado.app.help import io.legado.app.R import io.legado.app.constant.AppConst +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.http.newCallStrResponse import io.legado.app.help.http.okHttpClient -import io.legado.app.model.NoStackTraceException import io.legado.app.utils.jsonPath import io.legado.app.utils.readString import io.legado.app.utils.toastOnUi diff --git a/app/src/main/java/io/legado/app/help/DirectLinkUpload.kt b/app/src/main/java/io/legado/app/help/DirectLinkUpload.kt index ccdc1c7d8..e25537bbd 100644 --- a/app/src/main/java/io/legado/app/help/DirectLinkUpload.kt +++ b/app/src/main/java/io/legado/app/help/DirectLinkUpload.kt @@ -1,6 +1,6 @@ package io.legado.app.help -import io.legado.app.model.NoStackTraceException +import io.legado.app.exception.NoStackTraceException import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.utils.jsonPath diff --git a/app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt index 796a6866b..f6756deed 100644 --- a/app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt @@ -9,9 +9,9 @@ import io.legado.app.R import io.legado.app.constant.AppLog import io.legado.app.constant.PageAnim import io.legado.app.constant.PreferKey +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.DefaultData import io.legado.app.help.coroutine.Coroutine -import io.legado.app.model.NoStackTraceException import io.legado.app.ui.book.read.page.provider.ChapterProvider import io.legado.app.utils.* import kotlinx.coroutines.Dispatchers.IO diff --git a/app/src/main/java/io/legado/app/help/glide/OkHttpStreamFetcher.kt b/app/src/main/java/io/legado/app/help/glide/OkHttpStreamFetcher.kt index 1d9d26be2..2cde4f8fc 100644 --- a/app/src/main/java/io/legado/app/help/glide/OkHttpStreamFetcher.kt +++ b/app/src/main/java/io/legado/app/help/glide/OkHttpStreamFetcher.kt @@ -8,8 +8,8 @@ import com.bumptech.glide.load.data.DataFetcher import com.bumptech.glide.load.model.GlideUrl import com.bumptech.glide.util.ContentLengthInputStream import com.bumptech.glide.util.Preconditions +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.http.okHttpClient -import io.legado.app.model.NoStackTraceException import io.legado.app.utils.isWifiConnect import okhttp3.Call import okhttp3.Request diff --git a/app/src/main/java/io/legado/app/help/http/BackstageWebView.kt b/app/src/main/java/io/legado/app/help/http/BackstageWebView.kt index ab2e63503..1ed16c894 100644 --- a/app/src/main/java/io/legado/app/help/http/BackstageWebView.kt +++ b/app/src/main/java/io/legado/app/help/http/BackstageWebView.kt @@ -9,8 +9,8 @@ import android.webkit.WebSettings import android.webkit.WebView import android.webkit.WebViewClient import io.legado.app.constant.AppConst +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.config.AppConfig -import io.legado.app.model.NoStackTraceException import io.legado.app.utils.runOnUI import kotlinx.coroutines.Runnable import kotlinx.coroutines.suspendCancellableCoroutine diff --git a/app/src/main/java/io/legado/app/help/storage/AppWebDav.kt b/app/src/main/java/io/legado/app/help/storage/AppWebDav.kt index 3f63350c9..f7685d21d 100644 --- a/app/src/main/java/io/legado/app/help/storage/AppWebDav.kt +++ b/app/src/main/java/io/legado/app/help/storage/AppWebDav.kt @@ -7,12 +7,12 @@ import io.legado.app.R import io.legado.app.constant.PreferKey import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookProgress +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.config.AppConfig import io.legado.app.help.coroutine.Coroutine import io.legado.app.lib.dialogs.selector import io.legado.app.lib.webdav.HttpAuth import io.legado.app.lib.webdav.WebDav -import io.legado.app.model.NoStackTraceException import io.legado.app.utils.* import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.Main diff --git a/app/src/main/java/io/legado/app/model/CacheBook.kt b/app/src/main/java/io/legado/app/model/CacheBook.kt index 1e5ab1894..92f61b1a5 100644 --- a/app/src/main/java/io/legado/app/model/CacheBook.kt +++ b/app/src/main/java/io/legado/app/model/CacheBook.kt @@ -8,6 +8,7 @@ import io.legado.app.data.appDb import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookSource +import io.legado.app.exception.ConcurrentException import io.legado.app.help.BookHelp import io.legado.app.model.webBook.WebBook import io.legado.app.service.CacheBookService diff --git a/app/src/main/java/io/legado/app/model/Exceptions.kt b/app/src/main/java/io/legado/app/model/Exceptions.kt deleted file mode 100644 index 9edcaace7..000000000 --- a/app/src/main/java/io/legado/app/model/Exceptions.kt +++ /dev/null @@ -1,29 +0,0 @@ -@file:Suppress("unused") - -package io.legado.app.model - -/** - * 不记录错误堆栈的报错 - */ -open class NoStackTraceException(msg: String) : Exception(msg) { - - override fun fillInStackTrace(): Throwable { - return this - } - -} - -/** - * 目录为空 - */ -class TocEmptyException(msg: String) : NoStackTraceException(msg) - -/** - * 内容为空 - */ -class ContentEmptyException(msg: String) : NoStackTraceException(msg) - -/** - * 并发限制 - */ -class ConcurrentException(msg: String, val waitTime: Int) : NoStackTraceException(msg) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index 575e1957d..c14543cc8 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -12,11 +12,11 @@ import io.legado.app.constant.AppPattern.dataUriRegex import io.legado.app.data.entities.BaseSource import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter +import io.legado.app.exception.ConcurrentException import io.legado.app.help.CacheManager import io.legado.app.help.JsExtensions import io.legado.app.help.config.AppConfig import io.legado.app.help.http.* -import io.legado.app.model.ConcurrentException import io.legado.app.utils.* import kotlinx.coroutines.runBlocking import okhttp3.MediaType.Companion.toMediaType diff --git a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt index 0a20df12b..0c46586eb 100644 --- a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt +++ b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt @@ -7,9 +7,9 @@ import io.legado.app.constant.AppConst import io.legado.app.data.appDb import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter +import io.legado.app.exception.TocEmptyException import io.legado.app.help.BookHelp import io.legado.app.help.config.AppConfig -import io.legado.app.model.TocEmptyException import io.legado.app.utils.* import splitties.init.appCtx import java.io.File diff --git a/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt b/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt index fb5e578b6..9d52f7a42 100644 --- a/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt +++ b/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt @@ -4,8 +4,8 @@ import androidx.annotation.Keep import io.legado.app.R import io.legado.app.data.entities.RssArticle import io.legado.app.data.entities.RssSource +import io.legado.app.exception.NoStackTraceException import io.legado.app.model.Debug -import io.legado.app.model.NoStackTraceException import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.RuleData import io.legado.app.utils.NetworkUtils 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 720e0adc6..ee1b786fd 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 @@ -6,10 +6,10 @@ import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.rule.TocRule +import io.legado.app.exception.NoStackTraceException +import io.legado.app.exception.TocEmptyException import io.legado.app.help.ContentProcessor import io.legado.app.model.Debug -import io.legado.app.model.NoStackTraceException -import io.legado.app.model.TocEmptyException import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.utils.isTrue 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 852964498..dbcc6ff5b 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 @@ -6,10 +6,10 @@ import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.rule.ContentRule +import io.legado.app.exception.ContentEmptyException +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.BookHelp -import io.legado.app.model.ContentEmptyException import io.legado.app.model.Debug -import io.legado.app.model.NoStackTraceException import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.utils.HtmlFormatter 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 e2621161d..1ff5f0356 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 @@ -3,9 +3,9 @@ package io.legado.app.model.webBook import io.legado.app.R import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookSource +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.BookHelp import io.legado.app.model.Debug -import io.legado.app.model.NoStackTraceException import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.utils.DebugLog import io.legado.app.utils.HtmlFormatter 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 bcee6b537..cb9b55a0f 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 @@ -5,9 +5,9 @@ import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.SearchBook import io.legado.app.data.entities.rule.BookListRule +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.BookHelp import io.legado.app.model.Debug -import io.legado.app.model.NoStackTraceException import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.model.analyzeRule.RuleData diff --git a/app/src/main/java/io/legado/app/model/webBook/WebBook.kt b/app/src/main/java/io/legado/app/model/webBook/WebBook.kt index 09538958b..60665c3b3 100644 --- a/app/src/main/java/io/legado/app/model/webBook/WebBook.kt +++ b/app/src/main/java/io/legado/app/model/webBook/WebBook.kt @@ -4,10 +4,10 @@ import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.SearchBook +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.http.StrResponse import io.legado.app.model.Debug -import io.legado.app.model.NoStackTraceException import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.model.analyzeRule.RuleData import kotlinx.coroutines.CoroutineScope diff --git a/app/src/main/java/io/legado/app/service/CheckSourceService.kt b/app/src/main/java/io/legado/app/service/CheckSourceService.kt index 74930f94b..02a1ca05a 100644 --- a/app/src/main/java/io/legado/app/service/CheckSourceService.kt +++ b/app/src/main/java/io/legado/app/service/CheckSourceService.kt @@ -10,8 +10,12 @@ import io.legado.app.constant.IntentAction import io.legado.app.data.appDb import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookSource +import io.legado.app.exception.ContentEmptyException +import io.legado.app.exception.NoStackTraceException +import io.legado.app.exception.TocEmptyException import io.legado.app.help.config.AppConfig -import io.legado.app.model.* +import io.legado.app.model.CheckSource +import io.legado.app.model.Debug import io.legado.app.model.webBook.WebBook import io.legado.app.ui.book.source.manage.BookSourceActivity import io.legado.app.utils.activityPendingIntent @@ -22,10 +26,10 @@ import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.TimeoutCancellationException import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.launch -import java.util.concurrent.Executors -import kotlin.math.min import org.mozilla.javascript.WrappedException +import java.util.concurrent.Executors import javax.script.ScriptException +import kotlin.math.min /** * 校验书源 diff --git a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt index d7b61c6b4..399d339b2 100644 --- a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt @@ -10,10 +10,10 @@ import io.legado.app.R import io.legado.app.constant.AppLog import io.legado.app.constant.AppPattern import io.legado.app.constant.EventBus +import io.legado.app.exception.ConcurrentException +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.config.AppConfig import io.legado.app.help.coroutine.Coroutine -import io.legado.app.model.ConcurrentException -import io.legado.app.model.NoStackTraceException import io.legado.app.model.ReadAloud import io.legado.app.model.ReadBook import io.legado.app.model.analyzeRule.AnalyzeUrl diff --git a/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt b/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt index 620ac3abd..110a3816d 100644 --- a/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt @@ -8,10 +8,10 @@ import io.legado.app.constant.AppConst import io.legado.app.constant.AppLog import io.legado.app.constant.AppPattern import io.legado.app.constant.EventBus +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.MediaHelp import io.legado.app.help.config.AppConfig import io.legado.app.lib.dialogs.SelectItem -import io.legado.app.model.NoStackTraceException import io.legado.app.model.ReadAloud import io.legado.app.model.ReadBook import io.legado.app.utils.* diff --git a/app/src/main/java/io/legado/app/ui/association/BaseAssociationViewModel.kt b/app/src/main/java/io/legado/app/ui/association/BaseAssociationViewModel.kt index 92b28f692..abcb9f834 100644 --- a/app/src/main/java/io/legado/app/ui/association/BaseAssociationViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/association/BaseAssociationViewModel.kt @@ -6,8 +6,8 @@ import io.legado.app.base.BaseViewModel import io.legado.app.data.appDb import io.legado.app.data.entities.HttpTTS import io.legado.app.data.entities.TxtTocRule +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.config.ThemeConfig -import io.legado.app.model.NoStackTraceException import io.legado.app.utils.GSON import io.legado.app.utils.fromJsonArray import io.legado.app.utils.fromJsonObject diff --git a/app/src/main/java/io/legado/app/ui/association/FileAssociationViewModel.kt b/app/src/main/java/io/legado/app/ui/association/FileAssociationViewModel.kt index a0d401e82..a0ec71b1e 100644 --- a/app/src/main/java/io/legado/app/ui/association/FileAssociationViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/association/FileAssociationViewModel.kt @@ -4,7 +4,7 @@ import android.app.Application import android.net.Uri import androidx.documentfile.provider.DocumentFile import androidx.lifecycle.MutableLiveData -import io.legado.app.model.NoStackTraceException +import io.legado.app.exception.NoStackTraceException import io.legado.app.model.localBook.LocalBook import io.legado.app.utils.isJson import io.legado.app.utils.printOnDebug 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 00c6abf8e..6d1a97dde 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 @@ -8,13 +8,13 @@ import io.legado.app.base.BaseViewModel import io.legado.app.constant.AppPattern import io.legado.app.data.appDb import io.legado.app.data.entities.BookSource +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.ContentProcessor import io.legado.app.help.SourceHelp import io.legado.app.help.config.AppConfig import io.legado.app.help.http.newCallResponseBody import io.legado.app.help.http.okHttpClient import io.legado.app.help.http.text -import io.legado.app.model.NoStackTraceException import io.legado.app.utils.* diff --git a/app/src/main/java/io/legado/app/ui/association/ImportRssSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/association/ImportRssSourceViewModel.kt index e01af8671..cbfaf03e7 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportRssSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportRssSourceViewModel.kt @@ -8,12 +8,12 @@ import io.legado.app.base.BaseViewModel import io.legado.app.constant.AppPattern import io.legado.app.data.appDb import io.legado.app.data.entities.RssSource +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.SourceHelp import io.legado.app.help.config.AppConfig import io.legado.app.help.http.newCallResponseBody import io.legado.app.help.http.okHttpClient import io.legado.app.help.http.text -import io.legado.app.model.NoStackTraceException import io.legado.app.utils.* class ImportRssSourceViewModel(app: Application) : BaseViewModel(app) { diff --git a/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt index 769402304..74d13a090 100644 --- a/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt @@ -16,11 +16,11 @@ import io.legado.app.constant.AppPattern import io.legado.app.data.appDb import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.BookHelp import io.legado.app.help.ContentProcessor import io.legado.app.help.config.AppConfig import io.legado.app.help.storage.AppWebDav -import io.legado.app.model.NoStackTraceException import io.legado.app.utils.* import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ensureActive diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeChapterSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeChapterSourceViewModel.kt index d470c641d..9bc7185e6 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeChapterSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeChapterSourceViewModel.kt @@ -13,9 +13,9 @@ import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.SearchBook +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.config.AppConfig import io.legado.app.help.coroutine.CompositeCoroutine -import io.legado.app.model.NoStackTraceException import io.legado.app.model.webBook.WebBook import io.legado.app.utils.getPrefBoolean import io.legado.app.utils.getPrefString @@ -28,7 +28,6 @@ import kotlinx.coroutines.flow.callbackFlow import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.map import splitties.init.appCtx - import java.util.* import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.Executors diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt index a7b146dab..b257f5dc3 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt @@ -12,11 +12,11 @@ import io.legado.app.data.appDb import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookSource +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.BookHelp import io.legado.app.help.ContentProcessor import io.legado.app.help.coroutine.Coroutine import io.legado.app.model.BookCover -import io.legado.app.model.NoStackTraceException import io.legado.app.model.ReadBook import io.legado.app.model.localBook.LocalBook import io.legado.app.model.webBook.WebBook diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 18d810aff..800f14687 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -22,6 +22,7 @@ import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookProgress import io.legado.app.data.entities.BookSource +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.BookHelp import io.legado.app.help.IntentData import io.legado.app.help.config.ReadBookConfig @@ -32,7 +33,6 @@ import io.legado.app.help.storage.Backup import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.selector import io.legado.app.lib.theme.accentColor -import io.legado.app.model.NoStackTraceException import io.legado.app.model.ReadAloud import io.legado.app.model.ReadBook import io.legado.app.receiver.TimeBatteryReceiver diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt index d67da2122..c77dc24b2 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt @@ -12,12 +12,12 @@ import io.legado.app.data.appDb import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookProgress import io.legado.app.data.entities.BookSource +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.BookHelp import io.legado.app.help.ContentProcessor import io.legado.app.help.config.AppConfig import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.storage.AppWebDav -import io.legado.app.model.NoStackTraceException import io.legado.app.model.ReadAloud import io.legado.app.model.ReadBook import io.legado.app.model.localBook.LocalBook diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/HttpTtsEditViewModel.kt b/app/src/main/java/io/legado/app/ui/book/read/config/HttpTtsEditViewModel.kt index 5c5794714..374dd3861 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/HttpTtsEditViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/HttpTtsEditViewModel.kt @@ -5,7 +5,7 @@ import android.os.Bundle import io.legado.app.base.BaseViewModel import io.legado.app.data.appDb import io.legado.app.data.entities.HttpTTS -import io.legado.app.model.NoStackTraceException +import io.legado.app.exception.NoStackTraceException import io.legado.app.model.ReadAloud import io.legado.app.utils.getClipText import io.legado.app.utils.isJsonArray diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineViewModel.kt b/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineViewModel.kt index b85cebed1..d7b85e912 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineViewModel.kt @@ -6,11 +6,11 @@ import android.speech.tts.TextToSpeech import io.legado.app.base.BaseViewModel import io.legado.app.data.appDb import io.legado.app.data.entities.HttpTTS +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.DefaultData import io.legado.app.help.http.newCallResponseBody import io.legado.app.help.http.okHttpClient import io.legado.app.help.http.text -import io.legado.app.model.NoStackTraceException import io.legado.app.utils.isJsonArray import io.legado.app.utils.isJsonObject import io.legado.app.utils.readText 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 b471c1001..059e91a90 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,10 +5,10 @@ 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.exception.NoStackTraceException import io.legado.app.help.RuleComplete import io.legado.app.help.http.newCallStrResponse import io.legado.app.help.http.okHttpClient -import io.legado.app.model.NoStackTraceException import io.legado.app.utils.* import kotlinx.coroutines.Dispatchers diff --git a/app/src/main/java/io/legado/app/ui/browser/WebViewModel.kt b/app/src/main/java/io/legado/app/ui/browser/WebViewModel.kt index 6c3536b8a..16c813ef4 100644 --- a/app/src/main/java/io/legado/app/ui/browser/WebViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/browser/WebViewModel.kt @@ -8,13 +8,12 @@ import android.webkit.URLUtil import androidx.documentfile.provider.DocumentFile import io.legado.app.base.BaseViewModel import io.legado.app.constant.AppConst +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.IntentData import io.legado.app.help.http.newCallResponseBody import io.legado.app.help.http.okHttpClient -import io.legado.app.model.NoStackTraceException import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.utils.* - import java.io.File import java.util.* diff --git a/app/src/main/java/io/legado/app/ui/login/SourceLoginViewModel.kt b/app/src/main/java/io/legado/app/ui/login/SourceLoginViewModel.kt index 0c03c95cd..056b47612 100644 --- a/app/src/main/java/io/legado/app/ui/login/SourceLoginViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/login/SourceLoginViewModel.kt @@ -5,7 +5,7 @@ import android.content.Intent import io.legado.app.base.BaseViewModel import io.legado.app.data.appDb import io.legado.app.data.entities.BaseSource -import io.legado.app.model.NoStackTraceException +import io.legado.app.exception.NoStackTraceException import io.legado.app.utils.toastOnUi class SourceLoginViewModel(application: Application) : BaseViewModel(application) { diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfViewModel.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfViewModel.kt index 80d287fdf..3f7b8f720 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfViewModel.kt @@ -7,10 +7,10 @@ import io.legado.app.base.BaseViewModel import io.legado.app.data.appDb import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookSource +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.http.newCallResponseBody import io.legado.app.help.http.okHttpClient import io.legado.app.help.http.text -import io.legado.app.model.NoStackTraceException import io.legado.app.model.webBook.WebBook import io.legado.app.utils.* import kotlinx.coroutines.Dispatchers.IO diff --git a/app/src/main/java/io/legado/app/utils/DocumentExtensions.kt b/app/src/main/java/io/legado/app/utils/DocumentExtensions.kt index 10c3a6496..6ff50ad10 100644 --- a/app/src/main/java/io/legado/app/utils/DocumentExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/DocumentExtensions.kt @@ -5,7 +5,7 @@ import android.database.Cursor import android.net.Uri import android.provider.DocumentsContract import androidx.documentfile.provider.DocumentFile -import io.legado.app.model.NoStackTraceException +import io.legado.app.exception.NoStackTraceException import splitties.init.appCtx import java.io.File import java.nio.charset.Charset diff --git a/app/src/main/java/io/legado/app/utils/UriExtensions.kt b/app/src/main/java/io/legado/app/utils/UriExtensions.kt index 22540356d..4453834a5 100644 --- a/app/src/main/java/io/legado/app/utils/UriExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/UriExtensions.kt @@ -6,10 +6,9 @@ import androidx.appcompat.app.AppCompatActivity import androidx.documentfile.provider.DocumentFile import androidx.fragment.app.Fragment import io.legado.app.R +import io.legado.app.exception.NoStackTraceException import io.legado.app.lib.permission.Permissions import io.legado.app.lib.permission.PermissionsCompat -import io.legado.app.model.NoStackTraceException - import java.io.File fun Uri.isContentScheme() = this.scheme == "content"