From 1b0515ee9007e6be4048f6def030a5dacbb7568a Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Thu, 5 May 2022 06:42:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(ui/browser):=E6=B7=BB=E5=8A=A0=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/browser/WebViewActivity.kt | 6 ++++++ app/src/main/java/io/legado/app/ui/browser/WebViewModel.kt | 2 +- app/src/main/res/menu/web_view.xml | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) 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 71485b027..2f3fbef85 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 @@ -66,6 +66,12 @@ class WebViewActivity : VMBaseActivity() { when (item.itemId) { R.id.menu_open_in_browser -> openUrl(viewModel.baseUrl) R.id.menu_copy_url -> sendToClip(viewModel.baseUrl) + R.id.menu_ok -> { + if (viewModel.sourceVerificationEnable) { + binding.titleBar.snackbar(R.string.ok) + activity?.finish() + } + } } return super.onCompatOptionsItemSelected(item) } 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 79f6e21ad..7471db654 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 @@ -87,7 +87,7 @@ class WebViewModel(application: Application) : BaseViewModel(application) { if (sourceVerificationEnable) { val key = "${sourceOrigin}_verificationResult" html = AnalyzeUrl(baseUrl, headerMapF = headerMap).getStrResponse(useWebView = false).body - CacheManager.put(key, html!!) + CacheManager.put(key, html ?: "") } } diff --git a/app/src/main/res/menu/web_view.xml b/app/src/main/res/menu/web_view.xml index 281e17243..57b095c91 100644 --- a/app/src/main/res/menu/web_view.xml +++ b/app/src/main/res/menu/web_view.xml @@ -2,6 +2,12 @@ + +