From 32a0b2fbc2a46ce0bf0218979ee35415981c7e71 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 13 Feb 2020 21:50:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/book/search/SearchActivity.kt | 5 +++++ 1 file changed, 5 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 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)