[Android] Fix FilePicker browsing

Geoffrey Métais git at videolan.org
Thu May 26 16:27:22 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu May 26 15:30:39 2016 +0200| [f470cfb0870deacb3cd2d7843a75ff3a6aa7848e] | committer: Geoffrey Métais

Fix FilePicker browsing

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

 .../org/videolan/vlc/gui/browser/FilePickerFragment.java | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerFragment.java
index dc1a5f9..8f55fb5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerFragment.java
@@ -91,11 +91,17 @@ public class FilePickerFragment extends FileBrowserFragment {
     }
 
     public boolean defineIsRoot() {
-        String path = Strings.removeFileProtocole(mMrl);
-        for (int i = 0; i < rootDirectories.length; ++i) {
-            if (TextUtils.equals(path, rootDirectories[i]))
-                return true;
-        }
+        if (mMrl == null)
+            return true;
+        if (mMrl.startsWith("file")) {
+            String path = Strings.removeFileProtocole(mMrl);
+            for (int i = 0; i < rootDirectories.length; ++i) {
+                if (path.startsWith(rootDirectories[i]))
+                    return false;
+            }
+            return true;
+        } else if (TextUtils.isEmpty(Uri.parse(mMrl).getPath()))
+            return true;
         return false;
     }
 



More information about the Android mailing list