[Android] Remove media from the cache when deleting to prevent phantom media in the video list

Sébastien Toque git at videolan.org
Thu Aug 15 08:31:15 CEST 2013


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Thu Aug 15 08:31:00 2013 +0200| [db382cde95596c528f7bf04deffdeb6469981990] | committer: Sébastien Toque

Remove media from the cache when deleting to prevent phantom media in the video list

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=db382cde95596c528f7bf04deffdeb6469981990
---

 .../src/org/videolan/vlc/gui/video/VideoGridFragment.java    |   10 ++++++----
 1 file changed, 6 insertions(+), 4 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 3986df6..8e928d5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -286,14 +286,16 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
             startActivity(intent);
             return true;
         case R.id.video_list_delete:
-            final int positionDelete = position;
+            Media media = mVideoAdapter.getItem(position);
             AlertDialog alertDialog = CommonDialogs.deleteMedia(
                     getActivity(),
-                    mVideoAdapter.getItem(positionDelete).getLocation(),
-                    new VlcRunnable() {
+                    media.getLocation(),
+                    new VlcRunnable(media) {
                         @Override
                         public void run(Object o) {
-                            mVideoAdapter.remove(mVideoAdapter.getItem(positionDelete));
+                            Media media = (Media) o;
+                            mMediaLibrary.getMediaItems().remove(media);
+                            mVideoAdapter.remove(media);
                         }
                     });
             alertDialog.show();



More information about the Android mailing list