[Android] Fix video item update notification

Geoffrey Métais git at videolan.org
Fri May 27 10:01:16 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri May 27 09:59:59 2016 +0200| [eaab8600bd38aac67f4912f3475a99775ad10ae5] | committer: Geoffrey Métais

Fix video item update notification

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java | 6 +++---
 1 file changed, 3 insertions(+), 3 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 691c997..844910c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -243,6 +243,7 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
         int position = mVideos.indexOf(item);
         if (position != -1) {
             mVideos.set(position, item);
+            notifyItemChanged(position);
         } else {
             MediaWrapper mw;
             for (int i = 0; i < mVideos.size(); ++i) {
@@ -254,14 +255,13 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
             }
             if (position == -1) {
                 position = mVideos.size();
-                mVideos.add(item);
-                notifyItemChanged(position);
+                mVideos.add(position, item);
+                notifyItemInserted(position);
             } else {
                 mVideos.add(position, item);
                 notifyItemRangeChanged(position, mVideos.size());
             }
         }
-        notifyItemChanged(position);
     }
 
     public void clear() {



More information about the Android mailing list