feat(ui/browser):添加确认按钮

pull/1842/head
Xwite 3 years ago
parent e94a01bc69
commit 1b0515ee90
  1. 6
      app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/browser/WebViewModel.kt
  3. 6
      app/src/main/res/menu/web_view.xml

@ -66,6 +66,12 @@ class WebViewActivity : VMBaseActivity<ActivityWebViewBinding, WebViewModel>() {
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)
}

@ -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 ?: "")
}
}

@ -2,6 +2,12 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_ok"
android:icon="@drawable/ic_check"
android:title="@string/ok"
app:showAsAction="always" />
<item
android:id="@+id/menu_open_in_browser"
android:title="@string/open_in_browser"

Loading…
Cancel
Save