[Android] Properly update dataset in video adapter

Geoffrey Métais git at videolan.org
Wed Dec 20 17:10:06 CET 2017


vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec 18 16:28:10 2017 +0100| [3f983184cedf3a52697b831deb109a90bb165752] | committer: Geoffrey Métais

Properly update dataset in video adapter

(cherry picked from commit cf2f196fce1ff439ff4e43ab6d1c2d1d074211e9)

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java | 2 +-
 vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java  | 8 +-------
 2 files changed, 2 insertions(+), 8 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 44c40a18f..17793fde8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -149,7 +149,7 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
         if (savedInstanceState != null) {
             final ArrayList<MediaWrapper> list = (ArrayList<MediaWrapper>) VLCApplication.getData("list"+getTitle());
             if (!Util.isListEmpty(list))
-                mAdapter.setList(list);
+                mAdapter.update(list);
         }
         mGridView.setAdapter(mAdapter);
     }
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 8609e2161..ad07f0c0f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -170,12 +170,6 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
         return position;
     }
 
-    @MainThread
-    public void setList(List<MediaWrapper> items) {
-        setDataset(items);
-        mOriginalData = null;
-    }
-
     public boolean contains(MediaWrapper mw) {
         return mDataset.indexOf(mw) != -1;
     }
@@ -216,7 +210,7 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
 
     @MainThread
     public void clear() {
-        mDataset.clear();
+        update(new ArrayList<MediaWrapper>());
         mOriginalData = null;
     }
 



More information about the Android mailing list