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