本文整理汇总了Java中org.videolan.vlc.MediaDatabase类的典型用法代码示例。如果您正苦于以下问题:Java MediaDatabase类的具体用法?Java MediaDatabase怎么用?Java MediaDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MediaDatabase类属于org.videolan.vlc包,在下文中一共展示了MediaDatabase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getPictureFromCache
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
public static Bitmap getPictureFromCache(MediaWrapper media) {
// mPicture is not null only if passed through
// the ctor which is deprecated by now.
Bitmap b = media.getPicture();
if(b == null) {
BitmapCache cache = BitmapCache.getInstance();
Bitmap picture = cache.getBitmapFromMemCache(media.getLocation());
if(picture == null) {
/* Not in memcache:
* serving the file from the database and
* adding it to the memcache for later use.
*/
picture = readCoverBitmap(media.getArtworkURL());
if (picture == null)
picture = MediaDatabase.getInstance().getPicture(media.getUri());
cache.addBitmapToMemCache(media.getLocation(), picture);
}
return picture;
} else {
return b;
}
}
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:23,代码来源:BitmapUtil.java
示例2: updateFavorites
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
private void updateFavorites(){
ArrayList<MediaWrapper> favs = MediaDatabase.getInstance().getAllNetworkFav();
int newSize = favs.size(), totalSize = mAdapter.getItemCount();
if (newSize == 0 && mFavorites == 0)
return;
for (int i = 1 ; i <= mFavorites ; ++i){ //remove former favorites
mAdapter.removeItem(totalSize-i, mReadyToDisplay);
}
if (newSize == 0)
mAdapter.removeItem(totalSize-mFavorites-1, mReadyToDisplay); //also remove separator if no more fav
else {
if (mFavorites == 0)
mAdapter.addItem("Network favorites", false, false); //add header if needed
for (MediaWrapper fav : favs)
mAdapter.addItem(fav, false, false); //add new favorites
}
mFavorites = newSize; //update count
}
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:20,代码来源:NetworkBrowserFragment.java
示例3: handleContextItemSelected
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
@Override
protected boolean handleContextItemSelected(MenuItem item, int position) {
if (mRoot) {
if (item.getItemId() == R.id.directory_remove_custom_path){
BaseBrowserAdapter.Storage storage = (BaseBrowserAdapter.Storage) mAdapter.getItem(position);
MediaDatabase.getInstance().recursiveRemoveDir(storage.getUri().getPath());
CustomDirectories.removeCustomDirectory(storage.getUri().getPath());
mAdapter.updateMediaDirs();
mAdapter.removeItem(position, true);
((AudioPlayerContainerActivity)getActivity()).updateLib();
return true;
} else
return false;
} else
return super.handleContextItemSelected(item, position);
}
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:17,代码来源:FileBrowserFragment.java
示例4: savePlaylist
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
private void savePlaylist() {
new Thread(new Runnable() {
public void run() {
final MediaDatabase db = MediaDatabase.getInstance();
final String name = mEditText.getText().toString().trim();
if (db.playlistExists(name))
db.playlistDelete(name);
db.playlistAdd(name);
MediaWrapper mw;
for (int i = 0 ; i< mTracks.size() ; ++i){
mw = mTracks.get(i);
db.playlistInsertItem(name, i, mw.getLocation());
}
}
}).start();
dismiss();
}
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:18,代码来源:SavePlaylistDialog.java
示例5: onResume
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
if ((getActivity() instanceof MainActivity))
mMainActivity = (MainActivity) getActivity();
mMediaLibrary.setBrowser(this);
mMediaLibrary.addUpdateHandler(mHandler);
final boolean refresh = mVideoAdapter.isEmpty();
if (refresh)
updateList();
else {
mViewNomedia.setVisibility(View.GONE);
focusHelper(false);
}
//Get & set times
HashMap<String, Long> times = MediaDatabase.getInstance().getVideoTimes();
mVideoAdapter.setTimes(times);
mGridView.setSelection(mGVFirstVisiblePos);
updateViewMode();
if (mGroup == null && refresh)
mAnimator.animate();
/* Start the thumbnailer */
if (mThumbnailer != null)
mThumbnailer.start(this);
}
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:27,代码来源:VideoGridFragment.java
示例6: selectAudioTrack
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
private void selectAudioTrack() {
setESTrackLists();
selectTrack(mAudioTracksList, mService.getAudioTrack(), R.string.track_audio,
new TrackSelectedListener() {
@Override
public boolean onTrackSelected(int trackID) {
if (trackID < -1 || mService == null)
return false;
MediaDatabase.getInstance().updateMedia(
mUri,
MediaDatabase.mediaColumn.MEDIA_AUDIOTRACK,
trackID);
mService.setAudioTrack(trackID);
return true;
}
});
}
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:18,代码来源:VideoPlayerActivity.java
示例7: selectSubtitles
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
private void selectSubtitles() {
setESTrackLists();
selectTrack(mSubtitleTracksList, mService.getSpuTrack(), R.string.track_text,
new TrackSelectedListener() {
@Override
public boolean onTrackSelected(int trackID) {
if (trackID < -1 || mService == null)
return false;
MediaDatabase.getInstance().updateMedia(
mUri,
MediaDatabase.mediaColumn.MEDIA_SPUTRACK,
trackID);
mService.setSpuTrack(trackID);
return true;
}
});
}
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:19,代码来源:VideoPlayerActivity.java
示例8: setOverlayProgress
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
/**
* update the overlay
*/
private int setOverlayProgress() {
if (mService == null) {
return 0;
}
int time = (int) getTime();
int length = (int) mService.getLength();
if (length == 0) {
MediaWrapper media = MediaDatabase.getInstance().getMedia(mUri);
if (media != null)
length = (int) media.getLength();
}
// Update all view elements
mSeekbar.setMax(length);
mSeekbar.setProgress(time);
if (mSysTime != null)
mSysTime.setText(DateFormat.getTimeFormat(this).format(new Date(System.currentTimeMillis())));
if (time >= 0) mTime.setText(Strings.millisToString(time));
if (length >= 0) mLength.setText(mDisplayRemainingTime && length > 0
? "-" + '\u00A0' + Strings.millisToString(length - time)
: Strings.millisToString(length));
return time;
}
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:28,代码来源:VideoPlayerActivity.java
示例9: savePlaylist
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
private void savePlaylist() {
VLCApplication.runBackground(new Runnable() {
public void run() {
final MediaDatabase db = MediaDatabase.getInstance();
final String name = mEditText.getText().toString().trim();
if (db.playlistExists(name))
db.playlistDelete(name);
db.playlistAdd(name);
MediaWrapper mw;
for (int i = 0 ; i< mTracks.size() ; ++i){
mw = mTracks.get(i);
db.playlistInsertItem(name, i, mw.getLocation());
}
}
});
dismiss();
}
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:18,代码来源:SavePlaylistDialog.java
示例10: onResume
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
if ((getActivity() instanceof MainActivity))
mMainActivity = (MainActivity) getActivity();
mMediaLibrary.setBrowser(this);
mMediaLibrary.addUpdateHandler(mHandler);
final boolean refresh = mVideoAdapter.isEmpty();
if (refresh)
updateList();
else {
mViewNomedia.setVisibility(View.GONE);
focusHelper(false);
}
//Get & set times
ArrayMap<String, Long> times = MediaDatabase.getInstance().getVideoTimes();
mVideoAdapter.setTimes(times);
mGridView.setSelection(mGVFirstVisiblePos);
updateViewMode();
if (mGroup == null && refresh)
mAnimator.animate();
/* Start the thumbnailer */
if (mThumbnailer != null)
mThumbnailer.start(this);
}
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:27,代码来源:VideoGridFragment.java
示例11: selectAudioTrack
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
private void selectAudioTrack() {
setESTrackLists();
selectTrack(mAudioTracksList, mService.getAudioTrack(), R.string.track_audio,
new TrackSelectedListener() {
@Override
public boolean onTrackSelected(int trackID) {
if (trackID < -1 || mService == null)
return false;
MediaDatabase.getInstance().updateMedia(
mUri,
MediaDatabase.INDEX_MEDIA_AUDIOTRACK,
trackID);
mService.setAudioTrack(trackID);
return true;
}
});
}
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:18,代码来源:VideoPlayerActivity.java
示例12: selectSubtitles
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
private void selectSubtitles() {
setESTrackLists();
selectTrack(mSubtitleTracksList, mService.getSpuTrack(), R.string.track_text,
new TrackSelectedListener() {
@Override
public boolean onTrackSelected(int trackID) {
if (trackID < -1 || mService == null)
return false;
MediaDatabase.getInstance().updateMedia(
mUri,
MediaDatabase.INDEX_MEDIA_SPUTRACK,
trackID);
mService.setSpuTrack(trackID);
return true;
}
});
}
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:19,代码来源:VideoPlayerActivity.java
示例13: getPictureFromCache
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
public static Bitmap getPictureFromCache(Media media)
{
// mPicture is not null only if passed through
// the ctor which is deprecated by now.
Bitmap b = media.getPicture();
if(b == null) {
BitmapCache cache = BitmapCache.getInstance();
Bitmap picture = cache.getBitmapFromMemCache(media.getLocation());
if(picture == null) {
/* Not in memcache:
* serving the file from the database and
* adding it to the memcache for later use.
*/
Context c = VLCApplication.getAppContext();
picture = MediaDatabase.getInstance().getPicture(c, media.getLocation());
cache.addBitmapToMemCache(media.getLocation(), picture);
}
return picture;
} else {
return b;
}
}
开发者ID:smyhvae,项目名称:VlcTest,代码行数:23,代码来源:BitmapUtil.java
示例14: onCheckedChanged
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
final MediaDatabase dbManager = MediaDatabase.getInstance();
File item = (File) buttonView.getTag();
if (item == null)
return;
if (buttonView.isEnabled() && isChecked) {
dbManager.addDir(item.getPath());
File tmpFile = item.getParentFile();
while (tmpFile != null && !tmpFile.getPath().equals("/")) {
dbManager.removeDir(tmpFile.getPath());
tmpFile = tmpFile.getParentFile();
}
} else {
dbManager.removeDir(item.getPath());
}
}
开发者ID:smyhvae,项目名称:VlcTest,代码行数:19,代码来源:BrowserAdapter.java
示例15: onResume
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
//Get & set times
HashMap<String, Long> times = MediaDatabase.getInstance().getVideoTimes(getActivity());
mVideoAdapter.setTimes(times);
mVideoAdapter.notifyDataSetChanged();
updateList();
mMediaLibrary.addUpdateHandler(mHandler);
mGridView.setSelection(mGVFirstVisiblePos);
updateViewMode();
mAnimator.animate();
/* Start the thumbnailer */
if (mThumbnailer != null)
mThumbnailer.start(this);
}
开发者ID:smyhvae,项目名称:VlcTest,代码行数:18,代码来源:VideoGridFragment.java
示例16: onCheckedChanged
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
final MediaDatabase dbManager = MediaDatabase.getInstance(buttonView.getContext());
File item = (File) buttonView.getTag();
if (item == null)
return;
if (buttonView.isEnabled() && isChecked) {
dbManager.addDir(item.getPath());
File tmpFile = item.getParentFile();
while (tmpFile != null && !tmpFile.getPath().equals("/")) {
dbManager.removeDir(tmpFile.getPath());
tmpFile = tmpFile.getParentFile();
}
} else {
dbManager.removeDir(item.getPath());
}
}
开发者ID:KlepikovMD,项目名称:popcorntime-android-kitkat,代码行数:19,代码来源:BrowserAdapter.java
示例17: onResume
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
//Get & set times
HashMap<String, Long> times = MediaDatabase.getInstance(getActivity()).getVideoTimes(getActivity());
mVideoAdapter.setTimes(times);
mVideoAdapter.notifyDataSetChanged();
updateList();
mMediaLibrary.addUpdateHandler(mHandler);
updateViewMode();
mAnimator.animate();
/* Start the thumbnailer */
if (mThumbnailer != null)
mThumbnailer.start(this);
}
开发者ID:KlepikovMD,项目名称:popcorntime-android-kitkat,代码行数:17,代码来源:VideoGridFragment.java
示例18: processUri
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
private boolean processUri() {
if (!TextUtils.isEmpty(mEditText.getEditText().getText().toString())){
Util.openStream(getActivity(), mEditText.getEditText().getText().toString().trim());
MediaDatabase.getInstance().addMrlhistoryItem(mEditText.getEditText().getText().toString().trim());
updateHistory();
getActivity().supportInvalidateOptionsMenu();
mEditText.getEditText().getText().clear();
return true;
}
return false;
}
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:12,代码来源:MRLPanelFragment.java
示例19: browseRoot
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
@Override
protected void browseRoot() {
ArrayList<MediaWrapper> favs = MediaDatabase.getInstance().getAllNetworkFav();
if (!favs.isEmpty()) {
mFavorites = favs.size();
for (MediaWrapper fav : favs) {
mAdapter.addItem(fav, false, true);
}
mAdapter.addItem("Network favorites", false, true);
}
mMediaBrowser.discoverNetworkShares();
}
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:13,代码来源:NetworkBrowserFragment.java
示例20: toggleFavorite
import org.videolan.vlc.MediaDatabase; //导入依赖的package包/类
public void toggleFavorite() {
MediaDatabase db = MediaDatabase.getInstance();
if (db.networkFavExists(mCurrentMedia.getUri()))
db.deleteNetworkFav(mCurrentMedia.getUri());
else
db.addNetworkFavItem(mCurrentMedia.getUri(), mCurrentMedia.getTitle());
getActivity().supportInvalidateOptionsMenu();
}
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:9,代码来源:NetworkBrowserFragment.java
注:本文中的org.videolan.vlc.MediaDatabase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论