use of org.videolan.vlc.extensions.api.VLCExtensionItem in project vlc-android by videolan.
the class ExtensionBrowser method handleContextItemSelected.
protected boolean handleContextItemSelected(MenuItem item, final int position) {
switch(item.getItemId()) {
case R.id.extension_item_view_play_all:
List<VLCExtensionItem> items = mAdapter.getAll();
List<MediaWrapper> medias = new ArrayList<>(items.size());
for (VLCExtensionItem vlcItem : items) {
medias.add(Utils.mediawrapperFromExtension(vlcItem));
}
MediaUtils.openList(getActivity(), medias, position);
return true;
case R.id.extension_item_view_append:
MediaUtils.appendMedia(getActivity(), Utils.mediawrapperFromExtension(mAdapter.getItem(position)));
return true;
case R.id.extension_item_view_play_audio:
MediaWrapper mw = Utils.mediawrapperFromExtension(mAdapter.getItem(position));
mw.addFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
MediaUtils.openMedia(getActivity(), mw);
return true;
case R.id.extension_item_download:
// TODO
default:
return false;
}
}
use of org.videolan.vlc.extensions.api.VLCExtensionItem in project vlc-android by GeoffreyMetais.
the class ExtensionAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
final VLCExtensionItem item = getItem(position);
holder.binding.setItem(item);
holder.binding.executePendingBindings();
}
use of org.videolan.vlc.extensions.api.VLCExtensionItem in project vlc-android by GeoffreyMetais.
the class ExtensionBrowser method onCreateContextMenu.
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
if (menuInfo == null)
return;
ContextMenuRecyclerView.RecyclerContextMenuInfo info = (ContextMenuRecyclerView.RecyclerContextMenuInfo) menuInfo;
VLCExtensionItem item = mAdapter.getItem(info.position);
if (item.type == VLCExtensionItem.TYPE_DIRECTORY)
return;
boolean isVideo = item.type == VLCExtensionItem.TYPE_VIDEO;
getActivity().getMenuInflater().inflate(R.menu.extension_context_menu, menu);
menu.findItem(R.id.extension_item_view_play_audio).setVisible(isVideo);
}
use of org.videolan.vlc.extensions.api.VLCExtensionItem in project vlc-android by GeoffreyMetais.
the class ExtensionBrowser method handleContextItemSelected.
protected boolean handleContextItemSelected(MenuItem item, final int position) {
switch(item.getItemId()) {
case R.id.extension_item_view_play_all:
List<VLCExtensionItem> items = mAdapter.getAll();
List<MediaWrapper> medias = new ArrayList<>(items.size());
for (VLCExtensionItem vlcItem : items) {
medias.add(Utils.mediawrapperFromExtension(vlcItem));
}
MediaUtils.openList(getActivity(), medias, position);
return true;
case R.id.extension_item_view_append:
MediaUtils.appendMedia(getActivity(), Utils.mediawrapperFromExtension(mAdapter.getItem(position)));
return true;
case R.id.extension_item_view_play_audio:
MediaWrapper mw = Utils.mediawrapperFromExtension(mAdapter.getItem(position));
mw.addFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
MediaUtils.openMedia(getActivity(), mw);
return true;
case R.id.extension_item_download:
// TODO
default:
return false;
}
}
Aggregations