|
|
@ -280,12 +280,16 @@ class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_se |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Synchronized |
|
|
|
@Synchronized |
|
|
|
private fun upSearchItems(items: List<SearchBook>, isMandatoryUpdate: Boolean) { |
|
|
|
private fun upSearchItems(items: List<SearchBook>, isMandatoryUpdate: Boolean) { |
|
|
|
if (!isMandatoryUpdate && System.currentTimeMillis() - refreshTime < 1000) { |
|
|
|
if (!isMandatoryUpdate && System.currentTimeMillis() - refreshTime < 500) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
refreshTime = System.currentTimeMillis() |
|
|
|
refreshTime = System.currentTimeMillis() |
|
|
|
val diffResult = DiffUtil.calculateDiff(DiffCallBack(adapter.getItems(), items)) |
|
|
|
try { |
|
|
|
adapter.setItems(items, diffResult) |
|
|
|
val diffResult = DiffUtil.calculateDiff(DiffCallBack(adapter.getItems(), items)) |
|
|
|
|
|
|
|
adapter.setItems(items, diffResult) |
|
|
|
|
|
|
|
} catch (e: Exception) { |
|
|
|
|
|
|
|
e.printStackTrace() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|