feat: 优化代码

pull/164/head
kunfei 5 years ago
parent ee50620a73
commit f4298a88f8
  1. 3
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt

@ -285,7 +285,8 @@ class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_se
private fun upSearchItems(items: List<SearchBook>, isMandatoryUpdate: Boolean) {
if (isMandatoryUpdate || System.currentTimeMillis() - refreshTime > 500) {
refreshTime = System.currentTimeMillis()
val diffResult = DiffUtil.calculateDiff(DiffCallBack(adapter.getItems(), items))
val diffResult =
DiffUtil.calculateDiff(DiffCallBack(ArrayList(adapter.getItems()), items))
adapter.setItems(items, diffResult)
}
}

Loading…
Cancel
Save