Commit 399b9805 authored by Geoffrey Métais's avatar Geoffrey Métais

Just in time thumbnailer start

parent c326272b
...@@ -171,7 +171,7 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable ...@@ -171,7 +171,7 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if ((getActivity() instanceof MainActivity)) if (getActivity() instanceof MainActivity)
mMainActivity = (MainActivity) getActivity(); mMainActivity = (MainActivity) getActivity();
mMediaLibrary.setBrowser(this); mMediaLibrary.setBrowser(this);
mMediaLibrary.addUpdateHandler(mHandler); mMediaLibrary.addUpdateHandler(mHandler);
...@@ -190,10 +190,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable ...@@ -190,10 +190,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
updateViewMode(); updateViewMode();
if (animate) if (animate)
mAnimator.animate(); mAnimator.animate();
/* Start the thumbnailer */
if (mThumbnailer != null)
mThumbnailer.start(this);
} }
@Override @Override
...@@ -394,11 +390,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable ...@@ -394,11 +390,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
mSwipeRefreshLayout.setRefreshing(true); mSwipeRefreshLayout.setRefreshing(true);
final List<MediaWrapper> itemList = mMediaLibrary.getVideoItems(); 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) { if (itemList.size() > 0) {
VLCApplication.runBackground(new Runnable() { VLCApplication.runBackground(new Runnable() {
@Override @Override
...@@ -430,6 +421,8 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable ...@@ -430,6 +421,8 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
} }
}); });
if (mThumbnailer != null && !jobsList.isEmpty()) { if (mThumbnailer != null && !jobsList.isEmpty()) {
mThumbnailer.clearJobs();
mThumbnailer.start(VideoGridFragment.this);
for (MediaWrapper item : jobsList) for (MediaWrapper item : jobsList)
mThumbnailer.addJob(item); mThumbnailer.addJob(item);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment