Search in sources :

Example 46 with MediaLibraryItem

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);
        }
    });
}
Also used : Playlist(org.videolan.medialibrary.media.Playlist) MediaLibraryItem(org.videolan.medialibrary.media.MediaLibraryItem) ArrayList(java.util.ArrayList)

Aggregations

MediaLibraryItem (org.videolan.medialibrary.media.MediaLibraryItem)46 ArrayList (java.util.ArrayList)25 MediaWrapper (org.videolan.medialibrary.media.MediaWrapper)23 Bitmap (android.graphics.Bitmap)8 BitmapDrawable (android.graphics.drawable.BitmapDrawable)8 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)8 List (java.util.List)7 View (android.view.View)6 RecyclerView (android.support.v7.widget.RecyclerView)5 TextView (android.widget.TextView)4 Playlist (org.videolan.medialibrary.media.Playlist)4 Bundle (android.os.Bundle)3 LinkedList (java.util.LinkedList)3 Storage (org.videolan.medialibrary.media.Storage)3 ContextMenuRecyclerView (org.videolan.vlc.gui.view.ContextMenuRecyclerView)3 PackageManager (android.content.pm.PackageManager)2 Resources (android.content.res.Resources)2 WorkerThread (android.support.annotation.WorkerThread)2 TextInputLayout (android.support.design.widget.TextInputLayout)2 ImageCardView (android.support.v17.leanback.widget.ImageCardView)2