本文整理汇总了Java中org.videolan.vlc.MediaWrapper.TYPE_VIDEO属性的典型用法代码示例。如果您正苦于以下问题:Java MediaWrapper.TYPE_VIDEO属性的具体用法?Java MediaWrapper.TYPE_VIDEO怎么用?Java MediaWrapper.TYPE_VIDEO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.videolan.vlc.MediaWrapper
的用法示例。
在下文中一共展示了MediaWrapper.TYPE_VIDEO属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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);
}
}
示例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);
}
});
}
}
示例4: 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;
}
}
示例5: 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);
}
示例6: 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);
}
}
示例7: 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);
}
示例8: 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;
}