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 841d9ee87..1f0acfd0e 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 @@ -50,6 +50,7 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se private var menu: Menu? = null private var precisionSearchMenuItem: MenuItem? = null private var groups = hashSetOf() + private var refreshTime = System.currentTimeMillis() override fun onActivityCreated(savedInstanceState: Bundle?) { initRecyclerView() @@ -263,6 +264,10 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se @Synchronized private fun setSearchItems(items: List) { + if (System.currentTimeMillis() - refreshTime < 1000) { + return + } + refreshTime = System.currentTimeMillis() val diffResult = DiffUtil.calculateDiff(DiffCallBack(ArrayList(adapter.getItems()), items)) adapter.setItems(items, false) diffResult.dispatchUpdatesTo(adapter)