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