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 939c4dbec..1728f7320 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 @@ -85,6 +85,7 @@ class ReadRssActivity : VMBaseActivity override fun onCompatOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { + R.id.menu_rss_refresh -> viewModel.refresh() R.id.menu_rss_star -> viewModel.favorite() R.id.menu_share_it -> viewModel.rssArticle?.let { share(it.link) 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 56a70bb79..1badb5706 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 @@ -47,8 +47,7 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application), rssSource = appDb.rssSourceDao.getByKey(origin) if (link != null) { rssStar = appDb.rssStarDao.get(origin, link) - rssArticle = appDb.rssArticleDao.get(origin, link) - //rssArticle = rssStar?.toRssArticle() ?: appDb.rssArticleDao.get(origin, link) + rssArticle = rssStar?.toRssArticle() ?: appDb.rssArticleDao.get(origin, link) rssArticle?.let { rssArticle -> if (!rssArticle.description.isNullOrBlank()) { contentLiveData.postValue(rssArticle.description!!) @@ -106,6 +105,19 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application), } } + fun refresh() { + rssArticle?.let { rssArticle -> + rssSource?.let { + val ruleContent = it.ruleContent + if (!ruleContent.isNullOrBlank()) { + loadContent(rssArticle, ruleContent) + } else { + loadUrl(rssArticle.link, rssArticle.origin) + } + } ?: loadUrl(rssArticle.link, rssArticle.origin) + } + } + fun favorite() { execute { rssStar?.let { diff --git a/app/src/main/res/menu/rss_read.xml b/app/src/main/res/menu/rss_read.xml index 41280b275..062830439 100644 --- a/app/src/main/res/menu/rss_read.xml +++ b/app/src/main/res/menu/rss_read.xml @@ -1,6 +1,11 @@ +