From 4fdc262089f159704b96515a799532fc1d175fb4 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 18 Dec 2019 12:31:07 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/rss/read/ReadRssActivity.kt | 5 +++-- .../io/legado/app/ui/rss/read/ReadRssViewModel.kt | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) 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 4417d8fba..f20be3f87 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 @@ -59,10 +59,11 @@ class ReadRssActivity : VMBaseActivity(R.layout.activity_rss_r viewModel.rssArticle?.let { upJavaScriptEnable() val url = NetworkUtils.getAbsoluteURL(it.origin, it.link) + val html = viewModel.clHtml(content) if (viewModel.rssSource?.loadWithBaseUrl == true) { - webView.loadDataWithBaseURL(url, content, "text/html", "utf-8", url) + webView.loadDataWithBaseURL(url, html, "text/html", "utf-8", url) } else { - webView.loadData(content, "text/html", "utf-8") + webView.loadData(html, "text/html", "utf-8") } } }) diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt index 52c090072..8c6f56279 100644 --- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt @@ -77,6 +77,19 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application) { } } + fun clHtml(content: String): String { + return """ + + + + + + + $content + + """ + } + interface CallBack { fun upStarMenu() }