Commit c306a1f0 authored by Geoffrey Métais's avatar Geoffrey Métais

Restore playlist deletion

parent ad8307e7
...@@ -255,7 +255,6 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre ...@@ -255,7 +255,6 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
final MediaLibraryItem mediaItem = adapter.getItem(position); final MediaLibraryItem mediaItem = adapter.getItem(position);
if (id == R.id.audio_list_browser_delete) { 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 previous = position > 0 ? adapter.getItem(position-1) : null;
final MediaLibraryItem next = position < adapter.getItemCount()-1 ? adapter.getItem(position+1) : null; final MediaLibraryItem next = position < adapter.getItemCount()-1 ? adapter.getItem(position+1) : null;
final String message; final String message;
...@@ -267,7 +266,14 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre ...@@ -267,7 +266,14 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
else adapter.remove(mediaItem); else adapter.remove(mediaItem);
if (mode == MODE_PLAYLIST) { 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); message = getString(R.string.playlist_deleted);
action = new Runnable() { action = new Runnable() {
@Override @Override
...@@ -276,6 +282,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre ...@@ -276,6 +282,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
} }
}; };
} else if (mode == MODE_SONG) { } else if (mode == MODE_SONG) {
if (mediaItem.getItemType() != MediaLibraryItem.TYPE_MEDIA) return false;
message = getString(R.string.file_deleted); message = getString(R.string.file_deleted);
cancel = new Runnable() { cancel = new Runnable() {
@Override @Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment