当前位置: 首页>>代码示例>>Java>>正文


Java MediaWrapper.TYPE_AUDIO属性代码示例

本文整理汇总了Java中org.videolan.vlc.MediaWrapper.TYPE_AUDIO属性的典型用法代码示例。如果您正苦于以下问题:Java MediaWrapper.TYPE_AUDIO属性的具体用法?Java MediaWrapper.TYPE_AUDIO怎么用?Java MediaWrapper.TYPE_AUDIO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.videolan.vlc.MediaWrapper的用法示例。


在下文中一共展示了MediaWrapper.TYPE_AUDIO属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setContextMenu

protected void setContextMenu(MenuInflater inflater, Menu menu, int position) {
        MediaWrapper mw = (MediaWrapper) mAdapter.getItem(position);
        boolean canWrite = Util.canWrite(mw.getLocation());
        boolean isAudio = mw.getType() == MediaWrapper.TYPE_AUDIO;
        boolean isVideo = mw.getType() == MediaWrapper.TYPE_VIDEO;
        if (isAudio || isVideo) {
            inflater.inflate(R.menu.directory_view_file, menu);
            menu.findItem(R.id.directory_view_delete).setVisible(canWrite);
            menu.findItem(R.id.directory_view_info).setVisible(isVideo);
        } else if (mw.getType() == MediaWrapper.TYPE_DIR) {
            boolean isEmpty = mMediaLists.get(position) == null || mMediaLists.get(position).isEmpty();
            if (canWrite || !isEmpty) {
                inflater.inflate(R.menu.directory_view_dir, menu);
//                if (canWrite) {
//                    boolean nomedia = new File(mw.getLocation() + "/.nomedia").exists();
//                    menu.findItem(R.id.directory_view_hide_media).setVisible(!nomedia);
//                    menu.findItem(R.id.directory_view_show_media).setVisible(nomedia);
//                } else {
//                    menu.findItem(R.id.directory_view_hide_media).setVisible(false);
//                    menu.findItem(R.id.directory_view_show_media).setVisible(false);
//                }
                menu.findItem(R.id.directory_view_play_folder).setVisible(!isEmpty);
                menu.findItem(R.id.directory_view_delete).setVisible(canWrite);
            }
        }
    }
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:26,代码来源:BaseBrowserFragment.java

示例2: onBindMediaViewHolder

private void onBindMediaViewHolder(final RecyclerView.ViewHolder holder, int position) {
    final MediaViewHolder vh = (MediaViewHolder) holder;
    final MediaWrapper media = (MediaWrapper) getItem(position);
    boolean hasContextMenu = (media.getType() == MediaWrapper.TYPE_AUDIO ||
            media.getType() == MediaWrapper.TYPE_VIDEO ||
            media.getType() == MediaWrapper.TYPE_DIR );
    vh.binding.setPosition(position);
    vh.binding.setHandler(mClickHandler);
    vh.binding.setMedia(media);
    vh.binding.setHasContextMenu(hasContextMenu);
    vh.binding.setType(TYPE_MEDIA);
    vh.binding.executePendingBindings();

    vh.icon.setImageResource(getIconResId(media));
    if (hasContextMenu) {
        vh.itemView.setOnLongClickListener(this);
    }
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:18,代码来源:BaseBrowserAdapter.java

示例3: openMedia

public static void openMedia(final Context context, final MediaWrapper media){
    if (media == null)
        return;
    if (media.getType() == MediaWrapper.TYPE_VIDEO)
        VideoPlayerActivity.start(context, media.getUri(), media.getTitle());
    else if (media.getType() == MediaWrapper.TYPE_AUDIO) {
        new DialogCallback(context, new DialogCallback.Runnable() {
            @Override
            public void run(PlaybackService service) {
                service.load(media);
            }
        });
    }
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:14,代码来源:Util.java

示例4: getMediaSubtitle

public static String getMediaSubtitle(Context ctx, MediaWrapper media) {
    if (media.getType() == MediaWrapper.TYPE_AUDIO)
        return media.getNowPlaying() != null
                    ? media.getNowPlaying()
                    : getMediaArtist(ctx, media) + " - " + getMediaAlbum(ctx, media);
    else
        return "";
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:8,代码来源:Util.java

示例5: getIconResId

protected int getIconResId(MediaWrapper media) {
    switch (media.getType()){
        case MediaWrapper.TYPE_AUDIO:
            return R.drawable.ic_browser_audio_normal;
        case MediaWrapper.TYPE_DIR:
            return FOLDER_RES_ID;
        case MediaWrapper.TYPE_VIDEO:
            return R.drawable.ic_browser_video_normal;
        case MediaWrapper.TYPE_SUBTITLE:
            return R.drawable.ic_browser_subtitle_normal;
        default:
            return R.drawable.ic_browser_unknown_normal;
    }
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:14,代码来源:BaseBrowserAdapter.java

示例6: onMediaAdded

@Override
public void onMediaAdded(int index, Media media) {
    MediaWrapper mw = new MediaWrapper(media);
    int type = mw.getType();
    if (type == MediaWrapper.TYPE_AUDIO || type == MediaWrapper.TYPE_VIDEO || type == MediaWrapper.TYPE_DIR)
        mMediaList.add(mw);

    if (mUri == null) { // we are at root level
        mAdapter.clear();
        mAdapter.addAll(0, mMediaList); //FIXME adding 1 by 1 doesn't work
    }
    ((BrowserActivityInterface)getActivity()).showProgress(false);
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:13,代码来源:BrowserGridFragment.java

示例7: addMedia

private void addMedia(MediaWrapper media){
    int type = media.getType();
    if (type != MediaWrapper.TYPE_AUDIO && type != MediaWrapper.TYPE_VIDEO && type != MediaWrapper.TYPE_DIR)
        return;
    String letter = media.getTitle().substring(0, 1).toUpperCase();
    if (mMediaItemMap.containsKey(letter)){
        mMediaItemMap.get(letter).mediaList.add(media);
    } else {
        ListItem item = new ListItem(letter, media);
        mMediaItemMap.put(letter, item);
    }
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:12,代码来源:NetworkBrowserFragment.java

示例8: onMediaAdded

@Override
public void onMediaAdded(int index, Media media) {
    MediaWrapper mw = new MediaWrapper(media);
    int type = mw.getType();
    if (type == MediaWrapper.TYPE_AUDIO || type == MediaWrapper.TYPE_VIDEO || type == MediaWrapper.TYPE_DIR)
        mMediaList.add(mw);

    if (mUri == null) { // we are at root level
        mAdapter.clear();
        mAdapter.addAll(0, mMediaList); //FIXME adding 1 by 1 doesn't work
    }
    ((BrowserActivity)getActivity()).showProgress(false);
}
 
开发者ID:xuie0000,项目名称:vlc-android,代码行数:13,代码来源:BrowserGridFragment.java

示例9: handleContextItemSelected

protected boolean handleContextItemSelected(MenuItem item, int position) {
        int id = item.getItemId();
        if (! (mAdapter.getItem(position) instanceof MediaWrapper))
            return super.onContextItemSelected(item);
        MediaWrapper mw = (MediaWrapper) mAdapter.getItem(position);
        switch (id){
            case R.id.directory_view_play:
                mw.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
                Util.openMedia(getActivity(), mw);
                return true;
            case R.id.directory_view_append: {
                if (mService != null)
                    mService.append(mw);
                return true;
            }
            case R.id.directory_view_delete:
                AlertDialog alertDialog = CommonDialogs.deleteMedia(
                        mw.getType(), getActivity(), mw.getLocation(),
                        new VLCRunnable() {
                            @Override
                            public void run(Object o) {
                                refresh();
                            }
                        });
                alertDialog.show();
                return true;
            case  R.id.directory_view_info:
                Intent i = new Intent(getActivity(), SecondaryActivity.class);
                i.putExtra("fragment", "mediaInfo");
                i.putExtra("param", mw.getUri().toString());
                startActivity(i);
                return true;
            case R.id.directory_view_play_audio: {
                if (mService != null) {
                    mw.addFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
                    mService.load(mw);
                }
                return true;
            }
            case  R.id.directory_view_play_video:
                VideoPlayerActivity.start(getActivity(), mw.getUri());
                return true;
            case R.id.directory_view_play_folder:
                ArrayList<MediaWrapper> mediaList = new ArrayList<MediaWrapper>();
                for (MediaWrapper mediaItem : mMediaLists.get(position)){
                    if (mediaItem.getType() == MediaWrapper.TYPE_AUDIO || mediaItem.getType() == MediaWrapper.TYPE_VIDEO)
                        mediaList.add(mediaItem);
                }
                Util.openList(getActivity(), mediaList, 0);
                return true;
//            case R.id.directory_view_hide_media:
//                try {
//                    if (new File(mw.getLocation()+"/.nomedia").createNewFile())
//                        updateLib();
//                } catch (IOException e) {}
//                return true;
//            case R.id.directory_view_show_media:
//                if (new File(mw.getLocation()+"/.nomedia").delete())
//                    updateLib();
//                return true;
        }
        return false;
    }
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:63,代码来源:BaseBrowserFragment.java


注:本文中的org.videolan.vlc.MediaWrapper.TYPE_AUDIO属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。