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


Java MediaWrapper.getType方法代码示例

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


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

示例1: updateCardViewImage

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
protected void updateCardViewImage(MediaWrapper mediaWrapper) {
        mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
    Bitmap picture = null;
    if (mediaWrapper.getType() == mediaWrapper.TYPE_AUDIO) {
        picture = AudioUtil.getCover(sContext, mediaWrapper, 320);
        if (picture == null)
            picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_browser_audio_big_normal);
    } else if (mediaWrapper.getType() == mediaWrapper.TYPE_VIDEO) {
        picture = BitmapUtil.getPictureFromCache(mediaWrapper);
        if (picture == null)
            picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_browser_video_big_normal);
    } else if (mediaWrapper.getType() == mediaWrapper.TYPE_DIR)
        picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_menu_network_big);
    else
        picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_browser_unknown_big_normal);
    if (picture != null && picture.getByteCount() > 4)
        mCardView.setMainImage(new BitmapDrawable(mRes, picture));
    else
        mCardView.setMainImage(sDefaultCardImage);
}
 
开发者ID:xuie0000,项目名称:vlc-android,代码行数:21,代码来源:CardPresenter.java

示例2: sortList

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
public void sortList(){
    ArrayList<MediaWrapper> files = new ArrayList<MediaWrapper>(), dirs = new ArrayList<MediaWrapper>();
    for (Object item : mMediaList){
        if (item instanceof MediaWrapper) {
            MediaWrapper media = (MediaWrapper) item;
            if (media.getType() == MediaWrapper.TYPE_DIR)
                dirs.add(media);
            else
                files.add(media);
        }
    }
    if (dirs.isEmpty() && files.isEmpty())
        return;
    mMediaList.clear();
    if (!dirs.isEmpty()) {
        Collections.sort(dirs, MediaComparators.byName);
        mMediaList.addAll(dirs);
    }
    if (!files.isEmpty()) {
        Collections.sort(files, MediaComparators.byName);
        mMediaList.addAll(files);
    }
    notifyDataSetChanged();
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:25,代码来源:BaseBrowserAdapter.java

示例3: onKeyDown

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_BUTTON_Y) && mSelectedItem instanceof MediaWrapper) {
        MediaWrapper media = (MediaWrapper) mSelectedItem;
        if (media.getType() != MediaWrapper.TYPE_DIR)
            return false;
        Intent intent = new Intent(this,
                DetailsActivity.class);
        // pass the item information
        intent.putExtra("media", (MediaWrapper) mSelectedItem);
        intent.putExtra("item", new MediaItemDetails(media.getTitle(), media.getArtist(), media.getAlbum(), media.getLocation()));
        startActivity(intent);
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:17,代码来源:MainTvActivity.java

示例4: setContextMenu

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
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:xuie0000,项目名称:vlc-android,代码行数:27,代码来源:BaseBrowserFragment.java

示例5: fillView

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
private void fillView(ViewHolder holder, MediaWrapper media) {
    boolean group;
    String text = "";
    String resolution = "";
    int max = 0;
    int progress = 0;

    if (media.getType() == MediaWrapper.TYPE_GROUP) {
        group = true;
        MediaGroup mediaGroup = (MediaGroup) media;
        int size = mediaGroup.size();
        resolution = getContext().getResources().getQuantityString(R.plurals.videos_quantity, size, size);
    } else {
        group = false;
        /* Time / Duration */
        if (media.getLength() > 0) {
            long lastTime = media.getTime();
            if (lastTime > 0) {
                text = String.format("%s / %s",
                        Strings.millisToText(lastTime),
                        Strings.millisToText(media.getLength()));
                max = (int) (media.getLength() / 1000);
                progress = (int) (lastTime / 1000);
            } else {
                text = Strings.millisToText(media.getLength());
            }
        }
        if (media.getWidth() > 0 && media.getHeight() > 0)
            resolution = String.format("%dx%d", media.getWidth(), media.getHeight());
    }

    holder.binding.setVariable(BR.group, group);
    holder.binding.setVariable(BR.resolution, resolution);
    holder.binding.setVariable(BR.time, text);
    holder.binding.setVariable(BR.max, max);
    holder.binding.setVariable(BR.progress, progress);
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:38,代码来源:VideoListAdapter.java

示例6: getMediaSubtitle

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
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,代码行数:9,代码来源:Util.java

示例7: onMediaAdded

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
@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,代码行数:14,代码来源:BrowserGridFragment.java

示例8: getIconResId

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
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,代码行数:15,代码来源:BaseBrowserAdapter.java

示例9: addMedia

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
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,代码行数:13,代码来源:NetworkBrowserFragment.java

示例10: openMedia

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
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:hanhailong,项目名称:VCL-Android,代码行数:15,代码来源:Util.java

示例11: openMediaFromView

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
protected void openMediaFromView(View v) {
    final MediaViewHolder holder = (MediaViewHolder) v.getTag(R.id.layout_item);
    final MediaWrapper media = (MediaWrapper) getItem(holder.getAdapterPosition());
    if (media.getType() == MediaWrapper.TYPE_DIR)
        fragment.browse(media, holder.getAdapterPosition(), true);
    else
        ((FilePickerFragment)fragment).pickFile(media);
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:9,代码来源:FilePickerAdapter.java

示例12: handleContextItemSelected

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
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,代码行数:64,代码来源:BaseBrowserFragment.java


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