diff --git a/app/src/main/java/io/legado/app/api/controller/BookController.kt b/app/src/main/java/io/legado/app/api/controller/BookController.kt index 9ba9eb25d..b5c6739e1 100644 --- a/app/src/main/java/io/legado/app/api/controller/BookController.kt +++ b/app/src/main/java/io/legado/app/api/controller/BookController.kt @@ -180,7 +180,7 @@ object BookController { ?: return returnData.setErrorMsg("未找到书源") try { content = runBlocking { - WebBook.getContentAwait(this, bookSource, book, chapter).let { + WebBook.getContentAwait(bookSource, book, chapter).let { val contentProcessor = ContentProcessor.get(book.name, book.origin) contentProcessor.getContent(book, chapter, it, includeTitle = false) .joinToString("\n") 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 af2ef2a95..7d37300a1 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 @@ -238,12 +238,11 @@ object WebBook { context: CoroutineContext = Dispatchers.IO ): Coroutine { return Coroutine.async(scope, context) { - getContentAwait(scope, bookSource, book, bookChapter, nextChapterUrl, needSave) + getContentAwait(bookSource, book, bookChapter, nextChapterUrl, needSave) } } suspend fun getContentAwait( - scope: CoroutineScope, bookSource: BookSource, book: Book, bookChapter: BookChapter, 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 4005f9023..d8863b2e7 100644 --- a/app/src/main/java/io/legado/app/service/CheckSourceService.kt +++ b/app/src/main/java/io/legado/app/service/CheckSourceService.kt @@ -219,7 +219,6 @@ class CheckSourceService : BaseService() { //校验正文 if (CheckSource.checkContent) { WebBook.getContentAwait( - this, bookSource = source, book = mBook, bookChapter = toc.first(), 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 a3ad2b0bc..139a857b2 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 @@ -35,7 +35,7 @@ class ChangeChapterSourceViewModel(application: Application) : execute { val bookSource = appDb.bookSourceDao.getBookSource(book.origin) ?: throw NoStackTraceException("书源不存在") - WebBook.getContentAwait(this, bookSource, book, chapter, nextChapterUrl, false) + WebBook.getContentAwait(bookSource, book, chapter, nextChapterUrl, false) }.onSuccess { success.invoke(it) }.onError { diff --git a/app/src/main/java/io/legado/app/ui/book/read/ContentEditDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/ContentEditDialog.kt index c1a2d013a..6a724470e 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ContentEditDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ContentEditDialog.kt @@ -126,7 +126,7 @@ class ContentEditDialog : BaseDialogFragment(R.layout.dialog_content_edit) { content = null BookHelp.delContent(book, chapter) if (!book.isLocalBook()) ReadBook.bookSource?.let { bookSource -> - WebBook.getContentAwait(this, bookSource, book, chapter) + WebBook.getContentAwait(bookSource, book, chapter) } } return@execute content ?: let { 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 a29e9785d..acac64422 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 @@ -216,7 +216,6 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { toc.first() } WebBook.getContentAwait( - this, bookSource = source, book = book, bookChapter = toc[book.durChapterIndex], diff --git a/app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt b/app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt index 4288b2e16..504dbb6bb 100644 --- a/app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt +++ b/app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt @@ -125,12 +125,14 @@ class WebViewActivity : VMBaseActivity() { private fun upWebViewTheme() { if (AppConfig.isNightTheme) { if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK_STRATEGY)) { + @Suppress("DEPRECATION") WebSettingsCompat.setForceDarkStrategy( binding.webView.settings, WebSettingsCompat.DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING ) } if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) { + @Suppress("DEPRECATION") WebSettingsCompat.setForceDark( binding.webView.settings, WebSettingsCompat.FORCE_DARK_ON diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt index 9e9536741..b4fdab030 100644 --- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt @@ -141,7 +141,7 @@ class ReadRssActivity : VMBaseActivity SelectItem(getString(R.string.action_save), "save"), SelectItem(getString(R.string.select_folder), "selectFolder") ) - ) { _, charSequence, i -> + ) { _, charSequence, _ -> when (charSequence.value) { "save" -> saveImage(webPic) "selectFolder" -> selectSaveFolder(null) @@ -219,12 +219,14 @@ class ReadRssActivity : VMBaseActivity private fun upWebViewTheme() { if (AppConfig.isNightTheme) { if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK_STRATEGY)) { + @Suppress("DEPRECATION") WebSettingsCompat.setForceDarkStrategy( binding.webView.settings, WebSettingsCompat.DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING ) } if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) { + @Suppress("DEPRECATION") WebSettingsCompat.setForceDark( binding.webView.settings, WebSettingsCompat.FORCE_DARK_ON