Merge pull request #433 from 10bits/master

解决发现书籍不可以加载更多
pull/436/head
kunfei 4 years ago committed by GitHub
commit 1f9e9f2be9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt
  2. 6
      app/src/main/java/io/legado/app/ui/widget/recycler/LoadMoreView.kt

@ -38,6 +38,13 @@ class ExploreShowActivity : VMBaseActivity<ExploreShowViewModel>(R.layout.activi
loadMoreView = LoadMoreView(this) loadMoreView = LoadMoreView(this)
adapter.addFooterView(loadMoreView) adapter.addFooterView(loadMoreView)
loadMoreView.startLoad() loadMoreView.startLoad()
loadMoreView.setOnClickListener {
if (!isLoading) {
isLoading = true
loadMoreView.hasMore()
scrollToBottom()
}
}
recycler_view.addOnScrollListener(object : RecyclerView.OnScrollListener() { recycler_view.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)

@ -33,6 +33,12 @@ class LoadMoreView(context: Context) : FrameLayout(context) {
rotate_loading.hide() rotate_loading.hide()
} }
fun hasMore() {
hasMore = true
tv_text.invisible()
rotate_loading.show()
}
fun noMore(msg: String? = null) { fun noMore(msg: String? = null) {
hasMore = false hasMore = false
rotate_loading.hide() rotate_loading.hide()

Loading…
Cancel
Save