[Android] Do not clear adapter before refresh

Geoffrey Métais git at videolan.org
Sat Dec 3 17:39:32 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Sat Dec  3 17:28:36 2016 +0100| [6a3e925f345757aa3816a3fd6fe6b04eaad80b56] | committer: Geoffrey Métais

Do not clear adapter before refresh

> https://code.videolan.org/videolan/vlc-android/commit/6a3e925f345757aa3816a3fd6fe6b04eaad80b56
---

 vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java | 1 -
 vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java  | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

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 d6a0d1c..839e3fa 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -403,7 +403,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
                 mHandler.post(new Runnable() {
                     @Override
                     public void run() {
-                        mVideoAdapter.clear();
                         mVideoAdapter.dispatchUpdate(displayList);
                         mViewNomedia.setVisibility(mVideoAdapter.getItemCount() > 0 ? View.GONE : View.VISIBLE);
                         stopRefresh();
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index b6f066e..b31358f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -551,6 +551,7 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
 
     void dispatchUpdate(final ArrayList<MediaWrapper> newList) {
         final ArrayList<MediaWrapper> oldList = getAll();
+        mVideos.clear();
         addAll(newList);
         final DiffUtil.DiffResult result = DiffUtil.calculateDiff(new MediaItemDiffCallback(oldList, newList));
         mHandler.post(new Runnable() {



More information about the Android mailing list