[Android] Fix video deletion messing with items positions

Geoffrey Métais git at videolan.org
Fri Dec 11 10:20:49 CET 2015


vlc-android | branch: 1.7.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Dec 10 16:35:55 2015 +0100| [5c7e08c72ad29ed5147f460e2d58caa7ae53dbb9] | committer: Jean-Baptiste Kempf

Fix video deletion messing with items positions

(cherry picked from commit d28f9d5eb45ede946701bded00ba3409cf01037d)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 0357652..f56f5dc 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -219,7 +219,9 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
         if (position == -1)
             return;
         mVideos.remove(position);
-        notifyItemRemoved(position);
+        // Remove the whole end of list to update position tags stored in
+        // items views for databinder interactions, like contextual menu
+        notifyItemRangeChanged(position, getItemCount()-position);
     }
 
     private int getItemPosition(MediaWrapper mw) {



More information about the Android mailing list