From 1f3297d08da89d71e2d5ee1ba4099f9d5251b77b Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 13 Oct 2019 14:43:07 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt | 2 +- .../main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt | 4 +++- 2 files changed, 4 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 cef3e5361..8c8e0b5a2 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 @@ -38,7 +38,7 @@ class ReadRssActivity : VMBaseActivity(R.layout.activity_rss_r when (item.itemId) { R.id.menu_rss_star -> viewModel.rssArticleLiveData.value?.let { it.star = !it.star - viewModel.upRssArticle(it) + viewModel.upRssArticle(it) { upStarMenu() } } } return super.onCompatOptionsItemSelected(item) 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 0e063d42b..a8c0d2963 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 @@ -67,9 +67,11 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application) { } } - fun upRssArticle(rssArticle: RssArticle) { + fun upRssArticle(rssArticle: RssArticle, success: () -> Unit) { execute { App.db.rssArticleDao().update(rssArticle) + }.onSuccess { + success() } } } \ No newline at end of file