[Android] Util method to check if a folder can be favorited

Geoffrey Métais git at videolan.org
Mon Apr 18 16:07:10 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Apr 18 16:04:24 2016 +0200| [96d39f226c0e25210c4960ca661c4ab20164359d] | committer: Geoffrey Métais

Util method to check if a folder can be favorited

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

 vlc-android/src/org/videolan/vlc/util/FileUtils.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/util/FileUtils.java b/vlc-android/src/org/videolan/vlc/util/FileUtils.java
index 202cc5f..73a588b 100644
--- a/vlc-android/src/org/videolan/vlc/util/FileUtils.java
+++ b/vlc-android/src/org/videolan/vlc/util/FileUtils.java
@@ -34,6 +34,7 @@ import android.text.TextUtils;
 
 import org.videolan.libvlc.util.AndroidUtil;
 import org.videolan.vlc.VLCApplication;
+import org.videolan.vlc.media.MediaWrapper;
 
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
@@ -235,6 +236,19 @@ public class FileUtils {
         });
     }
 
+    public static boolean canSave(MediaWrapper mw){
+        if (mw == null || mw.getUri() == null)
+            return false;
+        String scheme = mw.getUri().getScheme();
+        if (TextUtils.equals(scheme, "file"))
+            return false;
+        return TextUtils.equals(scheme, "smb")   ||
+                TextUtils.equals(scheme, "nfs")  ||
+                TextUtils.equals(scheme, "ftp")  ||
+                TextUtils.equals(scheme, "ftps") ||
+                TextUtils.equals(scheme, "sftp");
+    }
+
     public static boolean canWrite(Uri uri){
         if (uri == null)
             return false;



More information about the Android mailing list