[Android] Restore playlist deletion

Geoffrey Métais git at videolan.org
Tue Jun 5 10:18:39 CEST 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jun  5 10:18:08 2018 +0200| [c306a1f0c11b80e63b2d3b2701988c0b7947be5a] | committer: Geoffrey Métais

Restore playlist deletion

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

 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java  | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index 756a75ecb..1eedd2f9a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -255,7 +255,6 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
         final MediaLibraryItem mediaItem = adapter.getItem(position);
 
         if (id == R.id.audio_list_browser_delete) {
-            if (mediaItem.getItemType() != MediaLibraryItem.TYPE_MEDIA) return false;
             final MediaLibraryItem previous = position > 0 ? adapter.getItem(position-1) : null;
             final MediaLibraryItem next = position < adapter.getItemCount()-1 ? adapter.getItem(position+1) : null;
             final String message;
@@ -267,7 +266,14 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
             else adapter.remove(mediaItem);
 
             if (mode == MODE_PLAYLIST) {
-                cancel = null;
+                if (mediaItem.getItemType() != MediaLibraryItem.TYPE_PLAYLIST) return false;
+                cancel = new Runnable() {
+                    @Override
+                    public void run() {
+                        if (separator != null) adapter.addItems(separator, mediaItem);
+                        else adapter.addItems(mediaItem);
+                    }
+                };
                 message = getString(R.string.playlist_deleted);
                 action = new Runnable() {
                     @Override
@@ -276,6 +282,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
                     }
                 };
             } else if (mode == MODE_SONG) {
+                if (mediaItem.getItemType() != MediaLibraryItem.TYPE_MEDIA) return false;
                 message = getString(R.string.file_deleted);
                 cancel = new Runnable() {
                     @Override



More information about the Android mailing list