[Android] Properly update dataset in video adapter

Geoffrey Métais git at videolan.org
Mon Dec 18 16:28:38 CET 2017


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

Properly update dataset in video adapter

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

 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 741d1ad09..49adfaf17 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -144,7 +144,7 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
         if (savedInstanceState != null) {
             final List<MediaWrapper> list = (List<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 8602dad0e..1aef38e1e 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 getDataset().indexOf(mw) != -1;
     }
@@ -216,7 +210,7 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
 
     @MainThread
     public void clear() {
-        getDataset().clear();
+        update(new ArrayList<MediaWrapper>());
         mOriginalData = null;
     }
 



More information about the Android mailing list