[Android] Just in time thumbnailer start

Geoffrey Métais git at videolan.org
Thu Jun 16 12:32:50 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun 16 12:31:47 2016 +0200| [399b98054eb98c9b01eb593686d89df0e1ef77df] | committer: Geoffrey Métais

Just in time thumbnailer start

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

 .../src/org/videolan/vlc/gui/video/VideoGridFragment.java   | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 501e813..7b476f3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -171,7 +171,7 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
     @Override
     public void onResume() {
         super.onResume();
-        if ((getActivity() instanceof MainActivity))
+        if (getActivity() instanceof MainActivity)
             mMainActivity = (MainActivity) getActivity();
         mMediaLibrary.setBrowser(this);
         mMediaLibrary.addUpdateHandler(mHandler);
@@ -190,10 +190,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
         updateViewMode();
         if (animate)
             mAnimator.animate();
-
-        /* Start the thumbnailer */
-        if (mThumbnailer != null)
-            mThumbnailer.start(this);
     }
 
     @Override
@@ -394,11 +390,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
             mSwipeRefreshLayout.setRefreshing(true);
         final List<MediaWrapper> itemList = mMediaLibrary.getVideoItems();
 
-        if (mThumbnailer != null)
-            mThumbnailer.clearJobs();
-        else
-            Log.w(TAG, "Can't generate thumbnails, the thumbnailer is missing");
-
         if (itemList.size() > 0) {
             VLCApplication.runBackground(new Runnable() {
                 @Override
@@ -430,6 +421,8 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
                         }
                     });
                     if (mThumbnailer != null && !jobsList.isEmpty()) {
+                        mThumbnailer.clearJobs();
+                        mThumbnailer.start(VideoGridFragment.this);
                         for (MediaWrapper item : jobsList)
                             mThumbnailer.addJob(item);
                     }



More information about the Android mailing list