[Android] Update last update sooner

Geoffrey Métais git at videolan.org
Tue Jan 16 17:44:43 CET 2018


vlc-android | branch: chromecast | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec 18 16:27:09 2017 +0100| [c5ff66bc46304788bc37b46da4e15aad787bde5d] | committer: Geoffrey Métais

Update last update sooner

peekLast was not returning the correct list

> https://code.videolan.org/videolan/vlc-android/commit/c5ff66bc46304788bc37b46da4e15aad787bde5d
---

 vlc-android/src/org/videolan/vlc/gui/DiffUtilAdapter.kt | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/DiffUtilAdapter.kt b/vlc-android/src/org/videolan/vlc/gui/DiffUtilAdapter.kt
index 19b81a173..38f500533 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DiffUtilAdapter.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/DiffUtilAdapter.kt
@@ -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>) {



More information about the Android mailing list