[Android] Hide favs header when no fav is displayed

Geoffrey Métais git at videolan.org
Fri Aug 3 10:08:57 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Aug  3 10:08:38 2018 +0200| [a3264e2f2f0a7b9df8e645df897e03c3f647e95b] | committer: Geoffrey Métais

Hide favs header when no fav is displayed

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

 .../src/org/videolan/vlc/providers/FileBrowserProvider.kt   | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/providers/FileBrowserProvider.kt b/vlc-android/src/org/videolan/vlc/providers/FileBrowserProvider.kt
index 172a4f754..cfbb46ed6 100644
--- a/vlc-android/src/org/videolan/vlc/providers/FileBrowserProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/providers/FileBrowserProvider.kt
@@ -66,9 +66,16 @@ open class FileBrowserProvider(
         uiJob(false) {
             if (favs.isNotEmpty()) {
                 job?.cancelAndJoin()
-                val quickAccess = VLCApplication.getAppResources().getString(R.string.browser_quick_access)
-                data.add(DummyItem(quickAccess))
-                for (fav in favs) if (File(fav.uri.path).exists()) data.add(fav)
+                val position = data.size
+                var favAdded = false
+                for (fav in favs) if (File(fav.uri.path).exists()) {
+                    favAdded = true
+                    data.add(fav)
+                }
+                if (favAdded) {
+                    val quickAccess = VLCApplication.getAppResources().getString(R.string.browser_quick_access)
+                    data.add(position, DummyItem(quickAccess))
+                }
             }
             dataset.value = data
             parseSubDirectories()



More information about the Android mailing list