[Android] Fix dataset replacement on activity re-creation

Geoffrey Métais git at videolan.org
Thu Dec 14 09:49:12 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Dec 14 09:46:39 2017 +0100| [262b5594182d2103c7b88a357d9e09d56b19ba28] | committer: Geoffrey Métais

Fix dataset replacement on activity re-creation

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java | 2 +-
 vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java  | 4 ++--
 2 files changed, 3 insertions(+), 3 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 cf4727ab4..741d1ad09 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.addAll(list);
+                mAdapter.setList(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 65f1a9c01..8602dad0e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -171,8 +171,8 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
     }
 
     @MainThread
-    public void addAll(Collection<MediaWrapper> items) {
-        getDataset().addAll(items);
+    public void setList(List<MediaWrapper> items) {
+        setDataset(items);
         mOriginalData = null;
     }
 



More information about the Android mailing list