[Android] Add thumbnails job after triggering display
Geoffrey Métais
git at videolan.org
Wed May 25 18:13:30 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed May 25 18:11:00 2016 +0200| [87eb40755593808c5caeaa23b3f0779012022b18] | committer: Geoffrey Métais
Add thumbnails job after triggering display
> https://code.videolan.org/videolan/vlc-android/commit/87eb40755593808c5caeaa23b3f0779012022b18
---
.../src/org/videolan/vlc/gui/video/VideoGridFragment.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 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 c53cfe5..d335579 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -174,6 +174,7 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
if ((getActivity() instanceof MainActivity))
mMainActivity = (MainActivity) getActivity();
mMediaLibrary.setBrowser(this);
+ mMediaLibrary.addUpdateHandler(mHandler);
final boolean refresh = mVideoAdapter.isEmpty();
// We don't animate while medialib is scanning. Because gridview is being populated.
// That would lead to graphical glitches
@@ -189,7 +190,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
updateViewMode();
if (animate)
mAnimator.animate();
- mMediaLibrary.addUpdateHandler(mHandler);
/* Start the thumbnailer */
if (mThumbnailer != null)
@@ -405,23 +405,27 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
@Override
public void run() {
final ArrayList<MediaWrapper> displayList = new ArrayList<>();
+ final ArrayList<MediaWrapper> jobsList = new ArrayList<>();
if (mGroup != null || itemList.size() <= 10) {
for (MediaWrapper item : itemList) {
if (mGroup == null || item.getTitle().startsWith(mGroup))
displayList.add(item);
+ jobsList.add(item);
}
} else {
List<MediaGroup> groups = MediaGroup.group(itemList);
- for (MediaGroup item : groups)
+ for (MediaGroup item : groups) {
displayList.add(item.getMedia());
+ for (MediaWrapper media : item.getAll())
+ jobsList.add(media);
+ }
}
- final ArrayList<MediaWrapper> jobsList = new ArrayList<>(displayList);
mVideoAdapter.addAll(displayList);
mVideoAdapter.sort();
if (mReadyToDisplay)
display();
- if (mThumbnailer != null) {
+ if (mThumbnailer != null && !jobsList.isEmpty()) {
for (MediaWrapper item : jobsList)
mThumbnailer.addJob(item);
}
More information about the Android
mailing list