[Android] VideoGrid: fix glitches when refreshing

Thomas Guillem git at videolan.org
Tue Oct 6 18:32:35 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Oct  6 18:31:11 2015 +0200| [2da55022cf289ba17af8dc585753a06efe862e8a] | committer: Thomas Guillem

VideoGrid: fix glitches when refreshing

Don't clear adapter from an other thread...

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

 .../src/org/videolan/vlc/gui/video/VideoGridFragment.java       |    7 +++----
 1 file changed, 3 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 3fca76c..8f57e78 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -412,17 +412,16 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
         else
             Log.w(TAG, "Can't generate thumbnails, the thumbnailer is missing");
 
-        mVideoAdapter.setNotifyOnChange(true);
-        mVideoAdapter.clear();
-
         if (itemList.size() > 0) {
             new Thread(new Runnable() {
                 @Override
                 public void run() {
+                    mVideoAdapter.setNotifyOnChange(false);
+                    mVideoAdapter.clear();
+
                     if (mGroup != null || itemList.size() <= 10) {
                         for (MediaWrapper item : itemList) {
                             if (mGroup == null || item.getTitle().startsWith(mGroup)) {
-                                mVideoAdapter.setNotifyOnChange(false);
                                 mVideoAdapter.add(item);
                                 if (mThumbnailer != null)
                                     mThumbnailer.addJob(item);



More information about the Android mailing list