Search in sources :

Example 6 with VLCExtensionItem

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;
    }
}
Also used : MediaWrapper(org.videolan.medialibrary.media.MediaWrapper) ArrayList(java.util.ArrayList) VLCExtensionItem(org.videolan.vlc.extensions.api.VLCExtensionItem)

Example 7 with VLCExtensionItem

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();
}
Also used : VLCExtensionItem(org.videolan.vlc.extensions.api.VLCExtensionItem)

Example 8 with VLCExtensionItem

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);
}
Also used : ContextMenuRecyclerView(org.videolan.vlc.gui.view.ContextMenuRecyclerView) VLCExtensionItem(org.videolan.vlc.extensions.api.VLCExtensionItem)

Example 9 with VLCExtensionItem

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;
    }
}
Also used : MediaWrapper(org.videolan.medialibrary.media.MediaWrapper) ArrayList(java.util.ArrayList) VLCExtensionItem(org.videolan.vlc.extensions.api.VLCExtensionItem)

Aggregations

VLCExtensionItem (org.videolan.vlc.extensions.api.VLCExtensionItem)9 ArrayList (java.util.ArrayList)3 Uri (android.net.Uri)2 MediaBrowserCompat (android.support.v4.media.MediaBrowserCompat)2 MediaDescriptionCompat (android.support.v4.media.MediaDescriptionCompat)2 MediaWrapper (org.videolan.medialibrary.media.MediaWrapper)2 ContextMenuRecyclerView (org.videolan.vlc.gui.view.ContextMenuRecyclerView)2 Bundle (android.os.Bundle)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 ExtensionBrowser (org.videolan.vlc.gui.browser.ExtensionBrowser)1