use of org.videolan.medialibrary.media.Storage in project vlc-android by GeoffreyMetais.
the class FileBrowserFragment method handleContextItemSelected.
@Override
protected boolean handleContextItemSelected(MenuItem item, int position) {
if (mRoot && item.getItemId() == R.id.directory_remove_custom_path) {
Storage storage = (Storage) mAdapter.getItem(position);
MediaDatabase.getInstance().recursiveRemoveDir(storage.getUri().getPath());
CustomDirectories.removeCustomDirectory(storage.getUri().getPath());
mProvider.remove(storage);
((AudioPlayerContainerActivity) getActivity()).updateLib();
return true;
} else
return super.handleContextItemSelected(item, position);
}
use of org.videolan.medialibrary.media.Storage in project vlc-android by GeoffreyMetais.
the class StorageBrowserAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final MediaViewHolder vh = (MediaViewHolder) holder;
MediaLibraryItem storage = getItem(position);
if (storage.getItemType() == MediaLibraryItem.TYPE_MEDIA)
storage = new Storage(((MediaWrapper) storage).getUri());
String storagePath = ((Storage) storage).getUri().getPath();
if (!storagePath.endsWith("/"))
storagePath += "/";
boolean hasContextMenu = mCustomDirsLocation.contains(storagePath);
boolean checked = ((StorageBrowserFragment) fragment).mScannedDirectory || mMediaDirsLocation.contains(storagePath);
vh.binding.setItem(storage);
vh.binding.setHasContextMenu(hasContextMenu);
if (checked)
vh.binding.browserCheckbox.setState(ThreeStatesCheckbox.STATE_CHECKED);
else if (hasDiscoveredChildren(storagePath))
vh.binding.browserCheckbox.setState(ThreeStatesCheckbox.STATE_PARTIAL);
else
vh.binding.browserCheckbox.setState(ThreeStatesCheckbox.STATE_UNCHECKED);
vh.binding.setCheckEnabled(!((StorageBrowserFragment) fragment).mScannedDirectory);
}
Aggregations