[Android] Fix dataset replacement on activity re-creation

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


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

Fix dataset replacement on activity re-creation

(cherry picked from commit 262b5594182d2103c7b88a357d9e09d56b19ba28)

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

 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 52ab90d45..44c40a18f 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.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 62575df60..8609e2161 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) {
-        mDataset.addAll(items);
+    public void setList(List<MediaWrapper> items) {
+        setDataset(items);
         mOriginalData = null;
     }
 



More information about the Android mailing list