From db6ea924fce458e58c0fc55ced1d3bc517cca488 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 10 Oct 2019 17:15:18 +0800 Subject: [PATCH] up --- .../legado/app/ui/rss/read/ReadRssActivity.kt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 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 3096a432e..4220d7575 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 @@ -4,6 +4,7 @@ import android.os.Bundle import androidx.lifecycle.Observer import io.legado.app.R import io.legado.app.base.VMBaseActivity +import io.legado.app.utils.NetworkUtils import io.legado.app.utils.getViewModel import kotlinx.android.synthetic.main.activity_rss_read.* @@ -19,14 +20,17 @@ class ReadRssActivity : VMBaseActivity(R.layout.activity_rss_r } private fun initLiveData() { - viewModel.contentLiveData.observe(this, Observer { - webView.loadDataWithBaseURL( - viewModel.rssArticle?.link, - "$it", - "text/html", - "utf-8", - viewModel.rssArticle?.link - ) + viewModel.contentLiveData.observe(this, Observer { content -> + viewModel.rssArticle?.let { + val url = NetworkUtils.getAbsoluteURL(it.origin, it.link ?: "") + webView.loadDataWithBaseURL( + url, + "$content", + "text/html", + "utf-8", + url + ) + } }) viewModel.urlLiveData.observe(this, Observer { webView.loadUrl(it)