From d640d941dcff77717022f90a6e4da216d4397017 Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 29 Oct 2019 16:25:32 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/book/search/SearchActivity.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt index 4b79b95f7..2e2342348 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt @@ -141,6 +141,14 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.adapter = adapter 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() { @@ -169,6 +177,12 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se } } + private fun scrollToBottom() { + if (!viewModel.isLoading) { + viewModel.search("") + } + } + private fun upGroupMenu() { val selectedGroup = getPrefString("searchGroup") ?: "" menu?.removeGroup(R.id.source_group)