[Android] Filter media added to LiveDataset

Geoffrey Métais git at videolan.org
Wed Apr 4 18:35:40 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 20 18:31:40 2018 +0100| [8f63b48cc2c2b65989c0639b8803798727d340aa] | committer: Geoffrey Métais

Filter media added to LiveDataset

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

 vlc-android/src/org/videolan/vlc/util/LiveDataset.kt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/util/LiveDataset.kt b/vlc-android/src/org/videolan/vlc/util/LiveDataset.kt
index 0527a98ac..960e38af9 100644
--- a/vlc-android/src/org/videolan/vlc/util/LiveDataset.kt
+++ b/vlc-android/src/org/videolan/vlc/util/LiveDataset.kt
@@ -20,7 +20,7 @@ class LiveDataset<T> : MutableLiveData<MutableList<T>>() {
     }
 
     fun add(items: List<T>) {
-        value = value.apply { addAll(items) }
+        value = value.apply { addAll(items.filter { !this.contains(it) }) }
     }
 
     fun remove(item: T) {



More information about the Android mailing list