[Android] Just in time thumbnailer start

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


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

Just in time thumbnailer start

(cherry picked from commit 399b98054eb98c9b01eb593686d89df0e1ef77df)

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

 .../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