[Android] Audio browser: add a function to the AudioBrowserListAdapter to return the media locations of an item
Adrien Maglo
git at videolan.org
Tue Nov 26 13:53:59 CET 2013
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Tue Nov 26 13:40:17 2013 +0100| [22ee29528707f1a7f4e03463c3f0c944cc510781] | committer: Adrien Maglo
Audio browser: add a function to the AudioBrowserListAdapter to return the media locations of an item
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=22ee29528707f1a7f4e03463c3f0c944cc510781
---
.../videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java | 5 ++---
.../org/videolan/vlc/gui/audio/AudioBrowserFragment.java | 5 ++---
.../org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java | 11 +++++++++++
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
index 350d486..6509967 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
@@ -184,9 +184,8 @@ public class AudioAlbumsSongsFragment extends SherlockFragment {
OnItemClickListener songsListener = new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> av, View v, int p, long id) {
- ArrayList<String> mediaLocation = new ArrayList<String>();
- mediaLocation.add(mSongsAdapter.getMedia(p).get(0).getLocation());
- mAudioController.load(mediaLocation, p);
+ ArrayList<String> mediaLocations = mSongsAdapter.getLocations(p);
+ mAudioController.load(mediaLocations, p);
AudioPlayerFragment.start(getActivity());
}
};
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index 0521c3d..306fe1b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -162,9 +162,8 @@ public class AudioBrowserFragment extends SherlockFragment implements ISortable
OnItemClickListener songListener = new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> av, View v, int p, long id) {
- ArrayList<String> mediaLocation = new ArrayList<String>();
- mediaLocation.add(mSongsAdapter.getMedia(p).get(0).getLocation());
- mAudioController.load(mediaLocation, p);
+ ArrayList<String> mediaLocations = mSongsAdapter.getLocations(p);
+ mAudioController.load(mediaLocations, p);
AudioPlayerFragment.start(getActivity());
}
};
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
index 096ae1c..2d577f3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
@@ -294,6 +294,17 @@ public class AudioBrowserListAdapter extends BaseAdapter implements ListAdapter
return mediaList;
}
+ public ArrayList<String> getLocations(int position) {
+ // Return all the media locations of a list item list.
+ ArrayList<String> locations = new ArrayList<String>();
+ if (!mItems.get(position).mIsSeparator) {
+ ArrayList<Media> media = mItems.get(position).mMediaList;
+ for (int i = 0; i < media.size(); ++i)
+ locations.add(media.get(i).getLocation());
+ }
+ return locations;
+ }
+
private boolean isMediaItemAboveASeparator(int position) {
// Test if a media item if above or not a separator.
if (mItems.get(position).mIsSeparator)
More information about the Android
mailing list