Skip to content
Snippets Groups Projects
Commit c5ff66bc authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Update last update sooner

peekLast was not returning the correct list
parent 8678da32
No related branches found
No related tags found
No related merge requests found
......@@ -18,14 +18,14 @@ abstract class DiffUtilAdapter<D : MediaLibraryItem, VH : RecyclerView.ViewHolde
@Volatile private var last = dataset
private val diffCallback by lazy(LazyThreadSafetyMode.NONE) { createCB() }
private val updateActor = actor<List<D>>(newSingleThreadContext("vlc-updater"), capacity = Channel.CONFLATED) {
for (list in channel) {
last = list
internalUpdate(list)
}
for (list in channel) internalUpdate(list)
}
protected abstract fun onUpdateFinished()
fun update (list: List<D>) = updateActor.offer(list)
fun update (list: List<D>) {
last = list
updateActor.offer(list)
}
@WorkerThread
private suspend fun internalUpdate(list: List<D>) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment