[Android] Network browser: Fix favorites disappearing

Geoffrey Métais git at videolan.org
Fri Jul 12 16:41:36 CEST 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jul 12 15:08:07 2019 +0200| [95e9d97681c271881caad5a8c2b93db95537e4d8] | committer: Geoffrey Métais

Network browser: Fix favorites disappearing

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

 vlc-android/src/org/videolan/vlc/providers/NetworkProvider.kt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/providers/NetworkProvider.kt b/vlc-android/src/org/videolan/vlc/providers/NetworkProvider.kt
index 94752d95b..cfc007357 100644
--- a/vlc-android/src/org/videolan/vlc/providers/NetworkProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/providers/NetworkProvider.kt
@@ -45,6 +45,9 @@ class NetworkProvider(context: Context, dataset: LiveDataset<MediaLibraryItem>,
 
     override suspend fun browseRootImpl() {
         dataset.clear()
+        dataset.value = mutableListOf<MediaLibraryItem>().apply {
+            getFavoritesList(favorites?.value)?.let { addAll(it) }
+        }
         if (ExternalMonitor.allowLan()) browse()
     }
 
@@ -54,9 +57,6 @@ class NetworkProvider(context: Context, dataset: LiveDataset<MediaLibraryItem>,
         val list by lazy(LazyThreadSafetyMode.NONE) { getList(url!!) }
         when {
             url == null -> {
-                dataset.value = mutableListOf<MediaLibraryItem>().apply {
-                    getFavoritesList(favorites?.value)?.let { addAll(it) }
-                }
                 browseRoot()
             }
             list !== null -> {



More information about the Android mailing list