pull/37/head
kunfei 5 years ago
parent 3de1fcdba3
commit db6ea924fc
  1. 20
      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 androidx.lifecycle.Observer
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.VMBaseActivity import io.legado.app.base.VMBaseActivity
import io.legado.app.utils.NetworkUtils
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_rss_read.* import kotlinx.android.synthetic.main.activity_rss_read.*
@ -19,14 +20,17 @@ class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_r
} }
private fun initLiveData() { private fun initLiveData() {
viewModel.contentLiveData.observe(this, Observer { viewModel.contentLiveData.observe(this, Observer { content ->
webView.loadDataWithBaseURL( viewModel.rssArticle?.let {
viewModel.rssArticle?.link, val url = NetworkUtils.getAbsoluteURL(it.origin, it.link ?: "")
"<style>img{max-width:100%}</style>$it", webView.loadDataWithBaseURL(
"text/html", url,
"utf-8", "<style>img{max-width:100%}</style>$content",
viewModel.rssArticle?.link "text/html",
) "utf-8",
url
)
}
}) })
viewModel.urlLiveData.observe(this, Observer { viewModel.urlLiveData.observe(this, Observer {
webView.loadUrl(it) webView.loadUrl(it)

Loading…
Cancel
Save