pull/35/head^2
kunfei 5 years ago
parent 1c44a4f6e4
commit fa01c3781c
  1. 5
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesActivity.kt
  2. 4
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt
  3. 17
      app/src/main/res/layout/activity_rss_artivles.xml

@ -24,7 +24,9 @@ class RssArticlesActivity : VMBaseActivity<RssArticlesViewModel>(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<RssArticlesViewModel>(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) {

@ -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()
}
}
}

@ -12,15 +12,24 @@
app:contentInsetStartWithNavigation="0dp"
app:displayHomeAsUp="true" />
<FrameLayout
<io.legado.app.ui.widget.anima.RefreshProgressBar
android:id="@+id/refresh_progress_bar"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="2dp"
app:layout_constraintTop_toBottomOf="@id/title_bar" />
<io.legado.app.ui.widget.recycler.scroller.FastScrollRecyclerView
<io.legado.app.ui.widget.dynamiclayout.DynamicFrameLayout
android:id="@+id/content_view"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/refresh_progress_bar">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</io.legado.app.ui.widget.dynamiclayout.DynamicFrameLayout>
</LinearLayout>
Loading…
Cancel
Save