[Android] Split the main constants for extensions too

Jean-Baptiste Kempf git at videolan.org
Wed Jul 4 12:40:52 CEST 2012


android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Jul  4 12:09:16 2012 +0200| [e33f84f44c74c6dbf128e448297067a2c91e3d8f] | committer: Jean-Baptiste Kempf

Split the main constants for extensions too

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=e33f84f44c74c6dbf128e448297067a2c91e3d8f
---

 vlc-android/src/org/videolan/vlc/Media.java        |   10 ++++++----
 vlc-android/src/org/videolan/vlc/MediaLibrary.java |    3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/Media.java b/vlc-android/src/org/videolan/vlc/Media.java
index b5eb7aa..71d8f10 100644
--- a/vlc-android/src/org/videolan/vlc/Media.java
+++ b/vlc-android/src/org/videolan/vlc/Media.java
@@ -30,7 +30,8 @@ public class Media implements Comparable<Media> {
 
     public final static String TAG = "VLC/MediaItem";
 
-    public final static HashSet<String> EXTENSIONS;
+    public final static HashSet<String> VIDEO_EXTENSIONS;
+    public final static HashSet<String> AUDIO_EXTENSIONS;
     public final static String EXTENSIONS_REGEX;
     public final static HashSet<String> FOLDER_BLACKLIST;
 
@@ -60,11 +61,12 @@ public class Media implements Comparable<Media> {
                 "/media/audio/ringtones",
                 "/Android/data/" };
 
-        EXTENSIONS = new HashSet<String>();
+        VIDEO_EXTENSIONS = new HashSet<String>();
         for (String item : video_extensions)
-            EXTENSIONS.add(item);
+            VIDEO_EXTENSIONS.add(item);
+        AUDIO_EXTENSIONS = new HashSet<String>();
         for (String item : audio_extensions)
-            EXTENSIONS.add(item);
+            AUDIO_EXTENSIONS.add(item);
 
         StringBuilder sb = new StringBuilder(115);
         sb.append(".+(\\.)((?i)(");
diff --git a/vlc-android/src/org/videolan/vlc/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
index 41625e9..d4dcec1 100644
--- a/vlc-android/src/org/videolan/vlc/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
@@ -283,7 +283,8 @@ public class MediaLibrary {
                     int dotIndex = fileName.lastIndexOf(".");
                     if (dotIndex != -1) {
                         String fileExt = fileName.substring(dotIndex);
-                        accepted = Media.EXTENSIONS.contains(fileExt);
+                        accepted = Media.AUDIO_EXTENSIONS.contains(fileExt) ||
+                                   Media.VIDEO_EXTENSIONS.contains(fileExt);
                     }
                 }
             }



More information about the Android mailing list