[Android] Check subtitles in browsing

Geoffrey Métais git at videolan.org
Mon Feb 9 11:30:46 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 20 18:53:11 2015 +0100| [44792444475770b5ac60ee040994faab03a7907b] | committer: Geoffrey Métais

Check subtitles in browsing

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=44792444475770b5ac60ee040994faab03a7907b
---

 vlc-android/src/org/videolan/vlc/MediaWrapper.java        |    3 +++
 .../src/org/videolan/vlc/gui/network/NetworkAdapter.java  |   13 ++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaWrapper.java b/vlc-android/src/org/videolan/vlc/MediaWrapper.java
index de1a3e9..6c65e18 100644
--- a/vlc-android/src/org/videolan/vlc/MediaWrapper.java
+++ b/vlc-android/src/org/videolan/vlc/MediaWrapper.java
@@ -43,6 +43,7 @@ public class MediaWrapper implements Parcelable {
     public final static int TYPE_AUDIO = 1;
     public final static int TYPE_GROUP = 2;
     public final static int TYPE_DIR = 3;
+    public final static int TYPE_SUBTITLE = 4;
 
     protected String mTitle;
     private String mArtist;
@@ -130,6 +131,8 @@ public class MediaWrapper implements Parcelable {
                     mType = TYPE_VIDEO;
                 } else if (Extensions.AUDIO.contains(fileExt)) {
                     mType = TYPE_AUDIO;
+                } else if (Extensions.SUBTITLES.contains(fileExt)) {
+                    mType = TYPE_SUBTITLE;
                 }
             }
             if (mType == TYPE_ALL) {
diff --git a/vlc-android/src/org/videolan/vlc/gui/network/NetworkAdapter.java b/vlc-android/src/org/videolan/vlc/gui/network/NetworkAdapter.java
index f6bd1eb..5d24413 100644
--- a/vlc-android/src/org/videolan/vlc/gui/network/NetworkAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/network/NetworkAdapter.java
@@ -105,7 +105,18 @@ public class NetworkAdapter extends  RecyclerView.Adapter<NetworkAdapter.ViewHol
     }
 
     public void sortList(){
-        Collections.sort(mMediaList, MediaComparators.byName);
+        ArrayList<MediaWrapper> files = new ArrayList<MediaWrapper>(), dirs = new ArrayList<MediaWrapper>();
+        for (MediaWrapper media : mMediaList){
+            if (media.getType() == MediaWrapper.TYPE_DIR)
+                dirs.add(media);
+            else
+                files.add(media);
+        }
+        Collections.sort(dirs, MediaComparators.byName);
+        Collections.sort(files, MediaComparators.byName);
+        mMediaList.clear();
+        mMediaList.addAll(dirs);
+        mMediaList.addAll(files);
         notifyDataSetChanged();
     }
 }



More information about the Android mailing list