Search in sources :

Example 6 with SavePlaylistDialog

use of org.videolan.vlc.gui.dialogs.SavePlaylistDialog in project vlc-android by videolan.

the class UiTools method addToPlaylist.

public static void addToPlaylist(FragmentActivity activity, MediaWrapper[] tracks, String key) {
    SavePlaylistDialog savePlaylistDialog = new SavePlaylistDialog();
    final Bundle args = new Bundle();
    args.putParcelableArray(key, tracks);
    savePlaylistDialog.setArguments(args);
    savePlaylistDialog.show(activity.getSupportFragmentManager(), "fragment_add_to_playlist");
}
Also used : Bundle(android.os.Bundle) SavePlaylistDialog(org.videolan.vlc.gui.dialogs.SavePlaylistDialog)

Example 7 with SavePlaylistDialog

use of org.videolan.vlc.gui.dialogs.SavePlaylistDialog in project vlc-android by GeoffreyMetais.

the class UiTools method addToPlaylist.

public static void addToPlaylist(FragmentActivity activity, MediaWrapper[] tracks, String key) {
    SavePlaylistDialog savePlaylistDialog = new SavePlaylistDialog();
    final Bundle args = new Bundle();
    args.putParcelableArray(key, tracks);
    savePlaylistDialog.setArguments(args);
    savePlaylistDialog.show(activity.getSupportFragmentManager(), "fragment_add_to_playlist");
}
Also used : Bundle(android.os.Bundle) SavePlaylistDialog(org.videolan.vlc.gui.dialogs.SavePlaylistDialog)

Example 8 with SavePlaylistDialog

use of org.videolan.vlc.gui.dialogs.SavePlaylistDialog in project vlc-android by GeoffreyMetais.

the class AudioAlbumsSongsFragment method handleContextItemSelected.

protected boolean handleContextItemSelected(MenuItem item, final int position) {
    int startPosition;
    MediaWrapper[] medias;
    int id = item.getItemId();
    final AudioBrowserAdapter adapter = mViewPager.getCurrentItem() == MODE_ALBUM ? mAlbumsAdapter : mSongsAdapter;
    final MediaLibraryItem mediaItem = adapter.getItem(position);
    boolean useAllItems = id == R.id.audio_list_browser_play_all;
    boolean append = id == R.id.audio_list_browser_append;
    boolean insert_next = id == R.id.audio_list_browser_insert_next;
    if (id == R.id.audio_list_browser_delete) {
        adapter.remove(mediaItem);
        final Runnable cancel = new Runnable() {

            @Override
            public void run() {
                adapter.addItems(mediaItem);
            }
        };
        UiTools.snackerWithCancel(mViewPager, getString(R.string.file_deleted), new Runnable() {

            @Override
            public void run() {
                deleteMedia(mediaItem, true, cancel);
            }
        }, cancel);
        return true;
    }
    if (id == R.id.audio_list_browser_set_song) {
        AudioUtil.setRingtone((MediaWrapper) mediaItem, getActivity());
        return true;
    }
    if (id == R.id.audio_view_info) {
        showInfoDialog((MediaWrapper) mediaItem);
        return true;
    }
    if (id == R.id.audio_view_add_playlist) {
        final FragmentManager fm = getActivity().getSupportFragmentManager();
        SavePlaylistDialog savePlaylistDialog = new SavePlaylistDialog();
        final Bundle args = new Bundle();
        args.putParcelableArray(SavePlaylistDialog.KEY_NEW_TRACKS, mediaItem.getTracks());
        savePlaylistDialog.setArguments(args);
        savePlaylistDialog.show(fm, "fragment_add_to_playlist");
        return true;
    }
    if (useAllItems) {
        final List<MediaLibraryItem> items = new ArrayList<>();
        startPosition = mSongsAdapter.getListWithPosition(items, position);
        medias = items.toArray(new MediaWrapper[items.size()]);
    } else {
        startPosition = 0;
        if (mediaItem instanceof Album)
            medias = mediaItem.getTracks();
        else
            medias = new MediaWrapper[] { (MediaWrapper) mediaItem };
    }
    if (append)
        MediaUtils.appendMedia(getActivity(), medias);
    else if (insert_next)
        MediaUtils.insertNext(getActivity(), medias);
    else
        MediaUtils.openArray(getActivity(), medias, startPosition);
    return true;
}
Also used : MediaWrapper(org.videolan.medialibrary.media.MediaWrapper) MediaLibraryItem(org.videolan.medialibrary.media.MediaLibraryItem) Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) Album(org.videolan.medialibrary.media.Album) SavePlaylistDialog(org.videolan.vlc.gui.dialogs.SavePlaylistDialog) FragmentManager(android.support.v4.app.FragmentManager)

Aggregations

Bundle (android.os.Bundle)8 SavePlaylistDialog (org.videolan.vlc.gui.dialogs.SavePlaylistDialog)8 FragmentManager (android.support.v4.app.FragmentManager)6 MediaWrapper (org.videolan.medialibrary.media.MediaWrapper)6 Uri (android.net.Uri)2 ArrayList (java.util.ArrayList)2 Album (org.videolan.medialibrary.media.Album)2 MediaLibraryItem (org.videolan.medialibrary.media.MediaLibraryItem)2