pull/43/head
kunfei 5 years ago
parent f8c4e9e955
commit d640d941dc
  1. 14
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt

@ -141,6 +141,14 @@ class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_se
recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.layoutManager = LinearLayoutManager(this)
recycler_view.adapter = adapter recycler_view.adapter = adapter
loadMoreView = LoadMoreView(this) loadMoreView = LoadMoreView(this)
recycler_view.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (!recyclerView.canScrollVertically(1)) {
scrollToBottom()
}
}
})
} }
private fun initOtherView() { private fun initOtherView() {
@ -169,6 +177,12 @@ class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_se
} }
} }
private fun scrollToBottom() {
if (!viewModel.isLoading) {
viewModel.search("")
}
}
private fun upGroupMenu() { private fun upGroupMenu() {
val selectedGroup = getPrefString("searchGroup") ?: "" val selectedGroup = getPrefString("searchGroup") ?: ""
menu?.removeGroup(R.id.source_group) menu?.removeGroup(R.id.source_group)

Loading…
Cancel
Save