use of org.videolan.medialibrary.media.MediaLibraryItem in project vlc-android by GeoffreyMetais.
the class PlaylistActivity method removeFromPlaylist.
private void removeFromPlaylist(final List<MediaWrapper> list) {
final List<MediaLibraryItem> oldAdapter = new ArrayList<>(mAdapter.getAll());
for (MediaLibraryItem mediaItem : list) mAdapter.remove(mediaItem);
UiTools.snackerWithCancel(mBinding.getRoot(), getString(R.string.file_deleted), new Runnable() {
@Override
public void run() {
for (MediaLibraryItem mediaItem : list) ((Playlist) mPlaylist).remove(mediaItem.getId());
if (mPlaylist.getTracks().length == 0)
((Playlist) mPlaylist).delete();
}
}, new Runnable() {
@Override
public void run() {
mAdapter.update(oldAdapter);
}
});
}
Aggregations