[Android] AudioBrowserFragment: add getListWithPosition()
Edward Wang
git at videolan.org
Thu Nov 28 23:20:32 CET 2013
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Nov 28 17:19:17 2013 -0500| [e3d736713a01c3ceb724f3769168e07965382e43] | committer: Edward Wang
AudioBrowserFragment: add getListWithPosition()
Add a function to return a single list containing all medias in this adapter.
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=e3d736713a01c3ceb724f3769168e07965382e43
---
.../vlc/gui/audio/AudioBrowserListAdapter.java | 24 ++++++++++++++++++++
1 file changed, 24 insertions(+)
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 fa8b32f..3b3579c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
@@ -297,6 +297,30 @@ public class AudioBrowserListAdapter extends BaseAdapter {
return locations;
}
+ /**
+ * Returns a single list containing all media, along with the position of
+ * the first media in 'position' in the _new_ single list.
+ *
+ * @param outputList The list to be written to.
+ * @param position Position to retrieve in to _this_ adapter.
+ * @return The position of 'position' in the new single list, or 0 if not found.
+ */
+ public int getListWithPosition(ArrayList<String> outputList, int position) {
+ int outputPosition = 0;
+ outputList.clear();
+ for(int i = 0; i < mItems.size(); i++) {
+ if(!mItems.get(i).mIsSeparator) {
+ if(position == i && !mItems.get(i).mMediaList.isEmpty())
+ outputPosition = outputList.size();
+
+ for(Media k : mItems.get(i).mMediaList) {
+ outputList.add(k.getLocation());
+ }
+ }
+ }
+ return outputPosition;
+ }
+
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