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 a7c09b1a8..0a0168bf5 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 @@ -24,7 +24,9 @@ class RssArticlesActivity : VMBaseActivity(R.layout.activi initView() intent.getStringExtra("url")?.let { initData(it) - viewModel.loadContent(it) + viewModel.loadContent(it) { + refresh_progress_bar.isAutoLoading = false + } } } @@ -33,6 +35,7 @@ class RssArticlesActivity : VMBaseActivity(R.layout.activi recycler_view.layoutManager = LinearLayoutManager(this) adapter = RssArticlesAdapter(this) recycler_view.adapter = adapter + refresh_progress_bar.isAutoLoading = true } private fun initData(origin: String) { 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 b1f8d70cb..f96478bf6 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 @@ -9,7 +9,7 @@ import java.net.URL class RssArticlesViewModel(application: Application) : BaseViewModel(application) { - fun loadContent(url: String) { + fun loadContent(url: String, onFinally: () -> Unit) { execute { val xml = URL(url).readText() RssParser.parseXML(xml).let { @@ -18,6 +18,8 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application } App.db.rssArtivleDao().insert(*it.toTypedArray()) } + }.onFinally { + onFinally() } } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_rss_artivles.xml b/app/src/main/res/layout/activity_rss_artivles.xml index 5665c8a24..43c2e25f8 100644 --- a/app/src/main/res/layout/activity_rss_artivles.xml +++ b/app/src/main/res/layout/activity_rss_artivles.xml @@ -12,15 +12,24 @@ app:contentInsetStartWithNavigation="0dp" app:displayHomeAsUp="true" /> - + android:layout_height="2dp" + app:layout_constraintTop_toBottomOf="@id/title_bar" /> - + + - + \ No newline at end of file