[Android] src: Load the entire directory into the audio controller as a list

Edward Wang git at videolan.org
Tue Jul 10 04:10:38 CEST 2012


android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Mon Jul  9 22:09:20 2012 -0400| [375646994d0602a87e419085aaea626e4b644d49] | committer: Edward Wang

src: Load the entire directory into the audio controller as a list

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

 vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java      |    7 +++++++
 vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java |    5 +----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
index 634d325..f96aff4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
@@ -311,6 +311,13 @@ public class DirectoryAdapter extends BaseAdapter {
         );
     }
 
+    public ArrayList<String> getAllMediaLocations() {
+        ArrayList<String> a = new ArrayList<String>();
+        for(int i = 0; i < mCurrentNode.children.size(); i++)
+            a.add(getMediaLocation(i));
+        return a;
+    }
+
     public void clear() {
         for(DirectoryAdapter.Node n : this.mCurrentNode.children)
             n.children.clear();
diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
index b4ba96b..78720f2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
@@ -21,7 +21,6 @@
 package org.videolan.vlc.gui;
 
 import java.io.IOException;
-import java.util.ArrayList;
 
 import org.videolan.vlc.AudioServiceController;
 import org.videolan.vlc.LibVLC;
@@ -70,9 +69,7 @@ public class DirectoryViewFragment extends SherlockListFragment implements ISort
 
             try {
                 if(!LibVLC.getExistingInstance().hasVideoTrack(mediaFile)) {
-                    ArrayList<String> arrayList = new ArrayList<String>();
-                    arrayList.add(mDirectoryAdapter.getMediaLocation(p));
-                    audioController.load(arrayList, 0);
+                    audioController.load(mDirectoryAdapter.getAllMediaLocations(), p);
                     Intent intent = new Intent(getActivity(), AudioPlayerActivity.class);
                     intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                     startActivity(intent);



More information about the Android mailing list