[Android] AudioPlayerFragment: simplify, don't recreate media twice
Edward Wang
git at videolan.org
Wed Dec 4 02:34:26 CET 2013
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Tue Dec 3 20:31:38 2013 -0500| [4de3847073e72e63c9dfa7f0e9913e23684481ca] | committer: Edward Wang
AudioPlayerFragment: simplify, don't recreate media twice
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=4de3847073e72e63c9dfa7f0e9913e23684481ca
---
.../org/videolan/vlc/gui/audio/AudioPlayerFragment.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
index 2538595..a8ce981 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
@@ -19,12 +19,11 @@
*****************************************************************************/
package org.videolan.vlc.gui.audio;
+import java.util.ArrayList;
import java.util.Collections;
-import java.util.List;
-
+import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.Media;
import org.videolan.vlc.AudioServiceController;
-import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.R;
import org.videolan.vlc.RepeatType;
import org.videolan.vlc.Util;
@@ -321,14 +320,15 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
}
private void updateList() {
- List<Media> audioList;
- List<String> itemList;
+ ArrayList<Media> audioList = new ArrayList<Media>();
String currentItem = null;
int currentIndex = -1;
- itemList = mAudioController.getMediaLocations();
+ LibVLC libVLC = LibVLC.getExistingInstance();
+ for (int i = 0; i < libVLC.getMediaList().size(); i++) {
+ audioList.add(libVLC.getMediaList().getMedia(i));
+ }
currentItem = mAudioController.getCurrentMediaLocation();
- audioList = MediaLibrary.getInstance(getActivity()).getMediaItems(itemList);
mSongsListAdapter.clear();
switch (mSortBy) {
More information about the Android
mailing list