[Android] Do not block UI

Geoffrey Métais git at videolan.org
Wed May 25 17:24:21 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed May 25 12:10:46 2016 +0200| [a596580cb5048f0fba39825da01330dd47e0a659] | committer: Geoffrey Métais

Do not block UI

> https://code.videolan.org/videolan/vlc-android/commit/a596580cb5048f0fba39825da01330dd47e0a659
---

 vlc-android/src/org/videolan/vlc/media/MediaLibrary.java | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/media/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/media/MediaLibrary.java
index 4ec8862..d617d69 100644
--- a/vlc-android/src/org/videolan/vlc/media/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/media/MediaLibrary.java
@@ -168,27 +168,21 @@ public class MediaLibrary {
 
     public ArrayList<MediaWrapper> getVideoItems() {
         ArrayList<MediaWrapper> videoItems = new ArrayList<>();
-        mItemListLock.readLock().lock();
-        for (int i = 0; i < mItemList.size(); i++) {
-            MediaWrapper item = mItemList.get(i);
+        for (MediaWrapper item : mItemList) {
             if (item != null && item.getType() == MediaWrapper.TYPE_VIDEO) {
                 videoItems.add(item);
             }
         }
-        mItemListLock.readLock().unlock();
         return videoItems;
     }
 
     public ArrayList<MediaWrapper> getAudioItems() {
         ArrayList<MediaWrapper> audioItems = new ArrayList<>();
-        mItemListLock.readLock().lock();
-        for (int i = 0; i < mItemList.size(); i++) {
-            MediaWrapper item = mItemList.get(i);
+        for (MediaWrapper item : mItemList) {
             if (item.getType() == MediaWrapper.TYPE_AUDIO) {
                 audioItems.add(item);
             }
         }
-        mItemListLock.readLock().unlock();
         return audioItems;
     }
 



More information about the Android mailing list