use of org.videolan.vlc.media.MediaDatabase in project vlc-android by videolan.
the class NetworkServerDialog method saveServer.
private void saveServer() {
String name = (TextUtils.isEmpty(mEditServername.getText().toString())) ? mEditAddress.getText().toString() : mEditServername.getText().toString();
Uri uri = Uri.parse(mUrl.getText().toString());
MediaDatabase db = MediaDatabase.getInstance();
if (mUri != null)
db.deleteNetworkFav(mUri);
db.addNetworkFavItem(uri, name, null);
}
use of org.videolan.vlc.media.MediaDatabase in project vlc-android by videolan.
the class BaseBrowserFragment method setContextMenuItems.
protected void setContextMenuItems(Menu menu, int position) {
final MediaWrapper mw = (MediaWrapper) mAdapter.getItem(position);
if (mw == null)
return;
final int type = mw.getType();
boolean canWrite = this instanceof FileBrowserFragment;
if (type == MediaWrapper.TYPE_DIR) {
final boolean isEmpty = Util.isListEmpty(mFoldersContentLists.get(mw));
// 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(!mRoot && canWrite);
if (this instanceof NetworkBrowserFragment) {
MediaDatabase db = MediaDatabase.getInstance();
if (db.networkFavExists(mw.getUri())) {
menu.findItem(R.id.network_remove_favorite).setVisible(true);
menu.findItem(R.id.network_edit_favorite).setVisible(!TextUtils.equals(mw.getUri().getScheme(), "upnp"));
} else
menu.findItem(R.id.network_add_favorite).setVisible(true);
}
} else {
boolean canPlayInList = mw.getType() == MediaWrapper.TYPE_AUDIO || (mw.getType() == MediaWrapper.TYPE_VIDEO && AndroidUtil.isHoneycombOrLater);
menu.findItem(R.id.directory_view_play_all).setVisible(canPlayInList);
menu.findItem(R.id.directory_view_append).setVisible(canPlayInList);
menu.findItem(R.id.directory_view_delete).setVisible(canWrite);
menu.findItem(R.id.directory_view_info).setVisible(type == MediaWrapper.TYPE_VIDEO || type == MediaWrapper.TYPE_AUDIO);
menu.findItem(R.id.directory_view_play_audio).setVisible(type != MediaWrapper.TYPE_AUDIO);
menu.findItem(R.id.directory_view_add_playlist).setVisible(type == MediaWrapper.TYPE_AUDIO);
menu.findItem(R.id.directory_subtitles_download).setVisible(type == MediaWrapper.TYPE_VIDEO);
}
}
use of org.videolan.vlc.media.MediaDatabase in project vlc-android by videolan.
the class NetworkBrowserFragment method toggleFavorite.
public void toggleFavorite() {
final MediaDatabase db = MediaDatabase.getInstance();
if (db.networkFavExists(mCurrentMedia.getUri()))
db.deleteNetworkFav(mCurrentMedia.getUri());
else
db.addNetworkFavItem(mCurrentMedia.getUri(), mCurrentMedia.getTitle(), mCurrentMedia.getArtworkURL());
getActivity().supportInvalidateOptionsMenu();
}
use of org.videolan.vlc.media.MediaDatabase in project vlc-android by GeoffreyMetais.
the class BaseBrowserFragment method setContextMenuItems.
protected void setContextMenuItems(Menu menu, int position) {
final MediaWrapper mw = (MediaWrapper) mAdapter.getItem(position);
if (mw == null)
return;
final int type = mw.getType();
boolean canWrite = this instanceof FileBrowserFragment;
if (type == MediaWrapper.TYPE_DIR) {
final boolean isEmpty = mProvider.isFolderEmpty(mw);
// 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(!mRoot && canWrite);
if (this instanceof NetworkBrowserFragment) {
final MediaDatabase db = MediaDatabase.getInstance();
if (db.networkFavExists(mw.getUri())) {
menu.findItem(R.id.network_remove_favorite).setVisible(true);
menu.findItem(R.id.network_edit_favorite).setVisible(!TextUtils.equals(mw.getUri().getScheme(), "upnp"));
} else
menu.findItem(R.id.network_add_favorite).setVisible(true);
}
} else {
boolean canPlayInList = mw.getType() == MediaWrapper.TYPE_AUDIO || (mw.getType() == MediaWrapper.TYPE_VIDEO);
menu.findItem(R.id.directory_view_play_all).setVisible(canPlayInList);
menu.findItem(R.id.directory_view_append).setVisible(canPlayInList);
menu.findItem(R.id.directory_view_delete).setVisible(canWrite);
menu.findItem(R.id.directory_view_info).setVisible(type == MediaWrapper.TYPE_VIDEO || type == MediaWrapper.TYPE_AUDIO);
menu.findItem(R.id.directory_view_play_audio).setVisible(type != MediaWrapper.TYPE_AUDIO);
menu.findItem(R.id.directory_view_add_playlist).setVisible(type == MediaWrapper.TYPE_AUDIO);
menu.findItem(R.id.directory_subtitles_download).setVisible(type == MediaWrapper.TYPE_VIDEO);
}
}
use of org.videolan.vlc.media.MediaDatabase in project vlc-android by GeoffreyMetais.
the class NetworkServerDialog method saveServer.
private void saveServer() {
String name = (TextUtils.isEmpty(mEditServername.getText().toString())) ? mEditAddress.getText().toString() : mEditServername.getText().toString();
Uri uri = Uri.parse(mUrl.getText().toString());
MediaDatabase db = MediaDatabase.getInstance();
if (mUri != null)
db.deleteNetworkFav(mUri);
db.addNetworkFavItem(uri, name, null);
}
Aggregations