本文整理汇总了Java中org.videolan.vlc.MediaWrapper.TYPE_DIR属性的典型用法代码示例。如果您正苦于以下问题:Java MediaWrapper.TYPE_DIR属性的具体用法?Java MediaWrapper.TYPE_DIR怎么用?Java MediaWrapper.TYPE_DIR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.videolan.vlc.MediaWrapper
的用法示例。
在下文中一共展示了MediaWrapper.TYPE_DIR属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sortList
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();
}
示例2: 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);
}
}
}
示例3: deleteMedia
public static AlertDialog deleteMedia(final int type,
final Context context,
final String addressMedia,
final String name,
final VLCRunnable runnable) {
String confirmMessage = "";
switch (type) {
case MediaWrapper.TYPE_DIR :
confirmMessage = context.getResources().getString(R.string.confirm_delete_folder, name);
break;
default :
confirmMessage = context.getResources().getString(R.string.confirm_delete, name);
break;
}
return confirmDialog( context, confirmMessage,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
Util.recursiveDelete(context, new File(Uri.decode(Strings.removeFileProtocole(addressMedia))));
if (runnable != null)
runnable.run();
}
});
}
示例4: sortList
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);
}
}
Collections.sort(dirs, MediaComparators.byName);
Collections.sort(files, MediaComparators.byName);
mMediaList.clear();
mMediaList.addAll(dirs);
mMediaList.addAll(files);
mAdapter.clear();
mAdapter.addAll(0, mMediaList);
mAdapter.notifyArrayItemRangeChanged(0, mMediaList.size());
}
示例5: 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);
}
}
示例6: onKeyDown
@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);
}
示例7: showDetails
public void showDetails() {
if (mItemSelected.getType() == MediaWrapper.TYPE_DIR) {
Intent intent = new Intent(getActivity(),
DetailsActivity.class);
// pass the item information
intent.putExtra("media", mItemSelected);
intent.putExtra("item", (Parcelable) new MediaItemDetails(mItemSelected.getTitle(), mItemSelected.getArtist(), mItemSelected.getAlbum(), mItemSelected.getLocation()));
startActivity(intent);
}
}
示例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
}
((BrowserActivityInterface)getActivity()).showProgress(false);
}
示例9: showDetails
public void showDetails() {
if (mItemSelected == null)
return;
if (mItemSelected.getType() == MediaWrapper.TYPE_DIR) {
Intent intent = new Intent(getActivity(),
DetailsActivity.class);
// pass the item information
intent.putExtra("media", mItemSelected);
intent.putExtra("item", (Parcelable) new MediaItemDetails(mItemSelected.getTitle(), mItemSelected.getArtist(), mItemSelected.getAlbum(), mItemSelected.getLocation()));
startActivity(intent);
}
}
示例10: openMediaFromView
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);
}
示例11: 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;
}
}
示例12: 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);
}
示例13: filter
private boolean filter(MediaWrapper mediaWrapper) {
return mediaWrapper.getType() == MediaWrapper.TYPE_DIR || mediaWrapper.getType() == MediaWrapper.TYPE_SUBTITLE;
}