[Android] Fix custom directories listing

Geoffrey Métais git at videolan.org
Wed Nov 30 17:28:48 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Nov 30 14:40:08 2016 +0100| [608f93fe5ce1e438fbb515e11814d2457ef2934b] | committer: Geoffrey Métais

Fix custom directories listing

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

 .../org/videolan/vlc/gui/browser/StorageBrowserFragment.java  | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
index 3ae4ef8..c517f4c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
@@ -107,7 +107,8 @@ public class StorageBrowserFragment extends FileBrowserFragment {
 
     @Override
     protected void browseRoot() {
-        String storages[] = mMediaLibrary.getDevices();
+        String[] storages = mMediaLibrary.getDevices();
+        String[] customDirectories = CustomDirectories.getCustomDirectories();
         Storage storage;
         for (String mediaDirLocation : storages) {
             if (TextUtils.isEmpty(mediaDirLocation))
@@ -117,6 +118,14 @@ public class StorageBrowserFragment extends FileBrowserFragment {
                 storage.setName(getString(R.string.internal_memory));
             mAdapter.addItem(storage, false, false);
         }
+        customLoop:
+        for (String customDir : customDirectories) {
+            for (String mediaDirLocation : storages)
+                if (customDir.startsWith(mediaDirLocation))
+                    continue customLoop;
+            storage = new Storage(Uri.parse(customDir));
+            mAdapter.addItem(storage, false, false);
+        }
         mHandler.sendEmptyMessage(BrowserFragmentHandler.MSG_HIDE_LOADING);
         if (mReadyToDisplay) {
             updateEmptyView();



More information about the Android mailing list