[Android] Filter videos on media updates

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


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 14 11:36:10 2018 +0100| [217e1643111da9b7b1e8dec9e9d396bbac0832b7] | committer: Geoffrey Métais

Filter videos on media updates

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

 vlc-android/src/org/videolan/vlc/viewmodels/VideosProvider.kt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/VideosProvider.kt b/vlc-android/src/org/videolan/vlc/viewmodels/VideosProvider.kt
index c8475b5c6..82767570b 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/VideosProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/VideosProvider.kt
@@ -36,11 +36,11 @@ class VideosProvider(private val group: String?) : MedialibraryModel<MediaWrappe
     override fun canSortByLastModified() = true
 
     override fun onMediaAdded(mediaList: Array<out MediaWrapper>?) {
-        if (!Util.isArrayEmpty<MediaWrapper>(mediaList)) updateActor.offer(MediaListAddition(mediaList!!.toList()))
+        if (!Util.isArrayEmpty<MediaWrapper>(mediaList)) updateActor.offer(MediaListAddition(mediaList!!.filter { it.type == MediaWrapper.TYPE_VIDEO }))
     }
 
     override fun onMediaUpdated(mediaList: Array<out MediaWrapper>?) {
-        if (!Util.isArrayEmpty<MediaWrapper>(mediaList)) updateActor.offer(MediaUpdate(mediaList!!.toList()))
+        if (!Util.isArrayEmpty<MediaWrapper>(mediaList)) updateActor.offer(MediaUpdate(mediaList!!.filter { it.type == MediaWrapper.TYPE_VIDEO }))
     }
 
     override suspend fun updateList() {



More information about the Android mailing list