[Android] DirectoryViewFragment: fix item selection in a folder with subfolers

Edward Wang git at videolan.org
Sat Jul 27 20:46:49 CEST 2013


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Jul 27 14:45:22 2013 -0400| [9cc7bce9cf8f177777a3b0f050d7f4336b8dfcc9] | committer: Edward Wang

DirectoryViewFragment: fix item selection in a folder with subfolers

Should also fix many IndexOutOfBoundsExceptions

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

 vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
index e90bc90..5d7abcd 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
@@ -21,6 +21,7 @@
 package org.videolan.vlc.gui;
 
 import java.io.IOException;
+import java.util.List;
 
 import org.videolan.libvlc.LibVLC;
 import org.videolan.vlc.AudioServiceController;
@@ -172,7 +173,8 @@ public class DirectoryViewFragment extends SherlockListFragment implements ISort
         try {
             if (LibVLC.getExistingInstance() == null
                     || !LibVLC.getExistingInstance().hasVideoTrack(mediaFile)) {
-                audioController.load(mDirectoryAdapter.getAllMediaLocations(), p-1); /* p-1 to exclude ".," */
+                List<String> mediaLocations = mDirectoryAdapter.getAllMediaLocations();
+                audioController.load(mediaLocations, mediaLocations.indexOf(mediaFile));
                 AudioPlayerActivity.start(getActivity());
             } else {
                 VideoPlayerActivity.start(getActivity(), mediaFile);



More information about the Android mailing list