From 9e08329f5ad6e7ccb49c6aa4d2e044111128c4f7 Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 19 Nov 2019 22:36:16 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/rss/article/RssArticlesActivity.kt | 4 +++- .../java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesActivity.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesActivity.kt index d28050509..8f11b3c09 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesActivity.kt @@ -39,7 +39,9 @@ class RssArticlesActivity : VMBaseActivity(R.layout.activi title_bar.title = it }) initView() - refresh_recycler_view.startLoading() + viewModel.initData(intent) { + refresh_recycler_view.startLoading() + } } override fun onCompatCreateOptionsMenu(menu: Menu): Boolean { diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt index 5ad2a3ef2..3c18a5abc 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt @@ -20,7 +20,7 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application var page = 1 var hasMore = true - fun initData(intent: Intent) { + fun initData(intent: Intent, finally: () -> Unit) { execute { url = intent.getStringExtra("url") url?.let { url -> @@ -31,6 +31,8 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application rssSource = RssSource(sourceUrl = url) } } + }.onFinally { + finally() } }