[Android] AudioBrowser: use VLCApplication.runBackground

Thomas Guillem git at videolan.org
Wed Oct 7 14:37:30 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Oct  7 14:37:23 2015 +0200| [c7066315056b1e48cc7a135b63b4d9321c3f57bb] | committer: Thomas Guillem

AudioBrowser: use VLCApplication.runBackground

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

 .../org/videolan/vlc/gui/audio/AudioBrowserFragment.java |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

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 02de4f4..9047045 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -74,8 +74,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Random;
 import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeRefreshLayout.OnRefreshListener, MediaBrowser.EventListener, IBrowser, ViewPager.OnPageChangeListener {
     public final static String TAG = "VLC/AudioBrowserFragment";
@@ -726,8 +724,7 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
             mTabLayout.setVisibility(View.VISIBLE);
             mHandler.sendEmptyMessageDelayed(MSG_LOADING, 300);
 
-            ExecutorService tpe = Executors.newSingleThreadExecutor();
-            ArrayList<Runnable> tasks = new ArrayList<Runnable>(Arrays.asList(updateArtists,
+            final ArrayList<Runnable> tasks = new ArrayList<Runnable>(Arrays.asList(updateArtists,
                     updateAlbums, updateSongs, updateGenres, updatePlaylists));
 
             //process the visible list first
@@ -739,8 +736,13 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
                         display();
                 }
             });
-            for (Runnable task : tasks)
-                tpe.submit(task);
+            VLCApplication.runBackground(new Runnable() {
+                @Override
+                public void run() {
+                    for (Runnable task : tasks)
+                        task.run();
+                }
+            });
         }
     }
 



More information about the Android mailing list