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

Sébastien Toque git at videolan.org
Tue Sep 10 01:09:05 CEST 2013


vlc-ports/android | branch: 0.1.x-bugfix | Sébastien Toque <xilasz at gmail.com> | Thu Aug 15 08:31:00 2013 +0200| [589f42070af53399545713f15b3ae6b559279023] | committer: Jean-Baptiste Kempf

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

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

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

 .../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 e503e8a..dee953d 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