|
|
@ -15,7 +15,8 @@ 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.* |
|
|
|
|
|
|
|
|
|
|
|
class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_read) { |
|
|
|
class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_read), |
|
|
|
|
|
|
|
ReadRssViewModel.CallBack { |
|
|
|
|
|
|
|
|
|
|
|
override val viewModel: ReadRssViewModel |
|
|
|
override val viewModel: ReadRssViewModel |
|
|
|
get() = getViewModel(ReadRssViewModel::class.java) |
|
|
|
get() = getViewModel(ReadRssViewModel::class.java) |
|
|
@ -23,6 +24,7 @@ class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_r |
|
|
|
private var starMenuItem: MenuItem? = null |
|
|
|
private var starMenuItem: MenuItem? = null |
|
|
|
|
|
|
|
|
|
|
|
override fun onActivityCreated(savedInstanceState: Bundle?) { |
|
|
|
override fun onActivityCreated(savedInstanceState: Bundle?) { |
|
|
|
|
|
|
|
viewModel.callBack = this |
|
|
|
title = intent.getStringExtra("title") |
|
|
|
title = intent.getStringExtra("title") |
|
|
|
initWebView() |
|
|
|
initWebView() |
|
|
|
initLiveData() |
|
|
|
initLiveData() |
|
|
@ -53,9 +55,8 @@ class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_r |
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("SetJavaScriptEnabled") |
|
|
|
@SuppressLint("SetJavaScriptEnabled") |
|
|
|
private fun initLiveData() { |
|
|
|
private fun initLiveData() { |
|
|
|
viewModel.rssArticleLiveData.observe(this, Observer { upStarMenu() }) |
|
|
|
|
|
|
|
viewModel.contentLiveData.observe(this, Observer { content -> |
|
|
|
viewModel.contentLiveData.observe(this, Observer { content -> |
|
|
|
viewModel.rssArticleLiveData.value?.let { |
|
|
|
viewModel.rssArticle?.let { |
|
|
|
upJavaScriptEnable() |
|
|
|
upJavaScriptEnable() |
|
|
|
val url = NetworkUtils.getAbsoluteURL(it.origin, it.link) |
|
|
|
val url = NetworkUtils.getAbsoluteURL(it.origin, it.link) |
|
|
|
if (viewModel.rssSource?.loadWithBaseUrl == true) { |
|
|
|
if (viewModel.rssSource?.loadWithBaseUrl == true) { |
|
|
@ -88,7 +89,7 @@ class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_r |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun upStarMenu() { |
|
|
|
override fun upStarMenu() { |
|
|
|
if (viewModel.star) { |
|
|
|
if (viewModel.star) { |
|
|
|
starMenuItem?.setIcon(R.drawable.ic_star) |
|
|
|
starMenuItem?.setIcon(R.drawable.ic_star) |
|
|
|
starMenuItem?.setTitle(R.string.y_store_up) |
|
|
|
starMenuItem?.setTitle(R.string.y_store_up) |
|
|
|