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");
}
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");
}
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;
}
Aggregations