|
|
|
@ -308,8 +308,9 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel> |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inner class CustomWebViewClient : WebViewClient() { |
|
|
|
|
|
|
|
|
|
override fun shouldOverrideUrlLoading( |
|
|
|
|
view: WebView?, |
|
|
|
|
view: WebView, |
|
|
|
|
request: WebResourceRequest? |
|
|
|
|
): Boolean { |
|
|
|
|
request?.let { |
|
|
|
@ -319,22 +320,27 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel> |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Suppress("DEPRECATION", "OVERRIDE_DEPRECATION", "KotlinRedundantDiagnosticSuppress") |
|
|
|
|
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean { |
|
|
|
|
override fun shouldOverrideUrlLoading(view: WebView, url: String?): Boolean { |
|
|
|
|
url?.let { |
|
|
|
|
return shouldOverrideUrlLoading(Uri.parse(it)) |
|
|
|
|
} |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onPageFinished(view: WebView?, url: String?) { |
|
|
|
|
override fun onPageFinished(view: WebView, url: String?) { |
|
|
|
|
super.onPageFinished(view, url) |
|
|
|
|
view?.title?.let { title -> |
|
|
|
|
view.title?.let { title -> |
|
|
|
|
if (title != url && title != view.url && title.isNotBlank() && url != "about:blank") { |
|
|
|
|
binding.titleBar.title = title |
|
|
|
|
} else { |
|
|
|
|
binding.titleBar.title = intent.getStringExtra("title") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
viewModel.rssSource?.injectJs?.let { |
|
|
|
|
if (it.isNotBlank()) { |
|
|
|
|
view.evaluateJavascript(it, null) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun shouldOverrideUrlLoading(url: Uri): Boolean { |
|
|
|
|