[Android] Make sure Diffutil has the right video list

Geoffrey Métais git at videolan.org
Mon Dec 5 15:32:10 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec  5 11:24:50 2016 +0100| [eaacd3062b7f636eb9bab56a4055891a58cf847c] | committer: Geoffrey Métais

Make sure Diffutil has the right video list

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

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 fb7be54..cddd2bb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -32,8 +32,6 @@ import android.preference.PreferenceManager;
 import android.support.annotation.MainThread;
 import android.support.annotation.Nullable;
 import android.support.v4.content.ContextCompat;
-import android.support.v4.util.SimpleArrayMap;
-import android.support.v4.util.SparseArrayCompat;
 import android.support.v7.util.DiffUtil;
 import android.support.v7.util.SortedList;
 import android.support.v7.widget.GridLayoutManager;
@@ -62,7 +60,6 @@ import org.videolan.vlc.util.MediaItemDiffCallback;
 import org.videolan.vlc.util.MediaItemFilter;
 import org.videolan.vlc.util.Strings;
 
-import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.LinkedList;
@@ -534,7 +531,7 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
         final ArrayList<MediaWrapper> oldList = getAll();
         mVideos.clear();
         addAll(newList);
-        final DiffUtil.DiffResult result = DiffUtil.calculateDiff(new VideoItemDiffCallback(oldList, newList));
+        final DiffUtil.DiffResult result = DiffUtil.calculateDiff(new VideoItemDiffCallback(oldList, getAll()));
         mHandler.post(new Runnable() {
             @Override
             public void run() {



More information about the Android mailing list