Search in sources :

Example 6 with Storage

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);
}
Also used : AudioPlayerContainerActivity(org.videolan.vlc.gui.AudioPlayerContainerActivity) Storage(org.videolan.medialibrary.media.Storage)

Example 7 with Storage

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);
}
Also used : Storage(org.videolan.medialibrary.media.Storage) MediaLibraryItem(org.videolan.medialibrary.media.MediaLibraryItem)

Aggregations

Storage (org.videolan.medialibrary.media.Storage)7 MediaLibraryItem (org.videolan.medialibrary.media.MediaLibraryItem)3 AudioPlayerContainerActivity (org.videolan.vlc.gui.AudioPlayerContainerActivity)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1