本文整理汇总了Java中org.videolan.vlc.VLCApplication.runBackground方法的典型用法代码示例。如果您正苦于以下问题:Java VLCApplication.runBackground方法的具体用法?Java VLCApplication.runBackground怎么用?Java VLCApplication.runBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.videolan.vlc.VLCApplication
的用法示例。
在下文中一共展示了VLCApplication.runBackground方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeDir
import org.videolan.vlc.VLCApplication; //导入方法依赖的package包/类
private void removeDir(final String path) {
VLCApplication.runBackground(new Runnable() {
@Override
public void run() {
//if media dir list was empty, we add all others
if (mMediaDirsLocation.isEmpty()) {
Storage storage;
String pathString;
for (Object item : mMediaList) {
storage = (Storage) item;
if (!TextUtils.equals(path, storage.getUri().getPath())) {
pathString = storage.getUri().getPath();
mDbManager.addDir(pathString);
}
}
} else {
mDbManager.removeDir(path);
}
updateMediaDirs();
if (isRoot && mMediaDirsLocation.isEmpty() && getItemCount() > 1)
refreshFragment();
}
});
}
示例2: addDir
import org.videolan.vlc.VLCApplication; //导入方法依赖的package包/类
private void addDir(final String path) {
VLCApplication.runBackground(new Runnable() {
@Override
public void run() {
mDbManager.addDir(path);
//No need to check for parents for now
// String parentPath = Strings.getParent(path);
// while (parentPath != null && !TextUtils.equals(parentPath, "/")) {
// mDbManager.removeDir(parentPath);
// parentPath = Strings.getParent(parentPath);
// }
//Remove subfolders, it would be redundant
for (String customDirPath : mMediaDirsLocation) {
if (customDirPath.startsWith(path+"/"))
mDbManager.removeDir(customDirPath);
}
updateMediaDirs();
}
});
}
示例3: savePlaylist
import org.videolan.vlc.VLCApplication; //导入方法依赖的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();
}
示例4: handleMessage
import org.videolan.vlc.VLCApplication; //导入方法依赖的package包/类
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
final AudioAlbumsSongsFragment fragment = getOwner();
switch (msg.what){
case DELETE_MEDIA:
AudioBrowserListAdapter.ListItem listItem = fragment.mSongsAdapter.getItem(msg.arg1);
MediaWrapper media = listItem.mMediaList.get(0);
final String path = media.getUri().getPath();
fragment.mMediaLibrary.getMediaItems().remove(media);
fragment.mSongsAdapter.removeMedia(media);
fragment.mAlbumsAdapter.removeMedia(media);
if (fragment.mService != null)
fragment.mService.removeLocation(media.getLocation());
fragment.mMediaLibrary.getMediaItems().remove(media);
VLCApplication.runBackground(new Runnable() {
public void run() {
Util.recursiveDelete(VLCApplication.getAppContext(), new File(path));
}
});
break;
}
}
示例5: deleteMedia
import org.videolan.vlc.VLCApplication; //导入方法依赖的package包/类
public void deleteMedia(int position){
final MediaWrapper media = mVideoAdapter.getItem(position);
final String path = media.getUri().getPath();
VLCApplication.runBackground(new Runnable() {
public void run() {
Util.recursiveDelete(VLCApplication.getAppContext(), new File(path));
}
});
mMediaLibrary.getMediaItems().remove(media);
mVideoAdapter.remove(media);
if (mService != null) {
final List<String> list = mService.getMediaLocations();
if (list != null && list.contains(media.getLocation())) {
mService.removeLocation(media.getLocation());
}
}
}
示例6: sort
import org.videolan.vlc.VLCApplication; //导入方法依赖的package包/类
private void sort(){
VLCApplication.runBackground(new Runnable() {
@Override
public void run() {
mMediaItemMap = new TreeMap<>(mMediaItemMap); //sort sections
for (ListItem item : mMediaItemMap.values()) {
Collections.sort(item.mediaList, MediaComparators.byName);
}
mHandler.sendEmptyMessage(UPDATE_DISPLAY);
}
});
}
示例7: queryByWords
import org.videolan.vlc.VLCApplication; //导入方法依赖的package包/类
private void queryByWords(String words) {
mRowsAdapter.clear();
if (!TextUtils.isEmpty(words) && words.length() > 2) {
mDelayedLoad.setSearchQuery(words);
mDelayedLoad.setSearchType(MediaWrapper.TYPE_ALL);
VLCApplication.runBackground(mDelayedLoad);
}
}
示例8: updateList
import org.videolan.vlc.VLCApplication; //导入方法依赖的package包/类
private void updateList() {
if (mMediaList == null || getActivity() == null)
return;
final Activity activity = getActivity();
mAlbumsAdapter.clear();
mSongsAdapter.clear();
VLCApplication.runBackground(new Runnable() {
@Override
public void run() {
Collections.sort(mMediaList, MediaComparators.byAlbum);
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < mMediaList.size(); ++i) {
MediaWrapper media = mMediaList.get(i);
mAlbumsAdapter.addSeparator(Util.getMediaReferenceArtist(activity, media), media);
mAlbumsAdapter.add(Util.getMediaAlbum(activity, media), null, media);
mSongsAdapter.addSeparator(Util.getMediaAlbum(activity, media), media);
}
mSongsAdapter.sortByAlbum();
mAlbumsAdapter.notifyDataSetChanged();
mSongsAdapter.notifyDataSetChanged();
mSwipeRefreshLayout.setRefreshing(false);
}
});
}
});
}
示例9: handleMessage
import org.videolan.vlc.VLCApplication; //导入方法依赖的package包/类
@Override
public void handleMessage(Message msg) {
final AudioBrowserFragment fragment = getOwner();
if(fragment == null) return;
switch (msg.what) {
case MediaLibrary.MEDIA_ITEMS_UPDATED:
fragment.updateLists();
break;
case MSG_LOADING:
if (fragment.mArtistsAdapter.isEmpty() && fragment.mAlbumsAdapter.isEmpty() &&
fragment.mSongsAdapter.isEmpty() && fragment.mGenresAdapter.isEmpty())
fragment.mSwipeRefreshLayout.setRefreshing(true);
break;
case DELETE_MEDIA:
MediaWrapper mw = fragment.mSongsAdapter.getItem(msg.arg1).mMediaList.get(0);
final String path = mw.getUri().getPath();
//Let's keep this toast while duration is not set correctly
VLCApplication.runBackground(new Runnable() {
public void run() {
Util.recursiveDelete(VLCApplication.getAppContext(), new File(path));
}
});
fragment.mMediaLibrary.getMediaItems().remove(mw);
refresh(fragment, path);
break;
case DELETE_PLAYLIST:
AudioBrowserListAdapter.ListItem listItem = fragment.mPlaylistAdapter.getItem(msg.arg1);
//Let's keep this toast while duration is not set correctly
if (!MediaDatabase.getInstance().playlistExists(listItem.mTitle)) { //File playlist
MediaWrapper media = listItem.mMediaList.get(0);
fragment.mMediaLibrary.getMediaItems().remove(media);
refresh(fragment, media.getLocation());
} else {
MediaDatabase.getInstance().playlistDelete(listItem.mTitle);
}
fragment.updateLists();
break;
}
}
示例10: updateLists
import org.videolan.vlc.VLCApplication; //导入方法依赖的package包/类
private void updateLists() {
mAudioList = MediaLibrary.getInstance().getAudioItems();
if (mAudioList.isEmpty()){
updateEmptyView(mViewPager.getCurrentItem());
mSwipeRefreshLayout.setRefreshing(false);
mTabLayout.setVisibility(View.GONE);
focusHelper(true, R.id.artists_list);
} else {
mTabLayout.setVisibility(View.VISIBLE);
mHandler.sendEmptyMessageDelayed(MSG_LOADING, 300);
final ArrayList<Runnable> tasks = new ArrayList<Runnable>(Arrays.asList(updateArtists,
updateAlbums, updateSongs, updateGenres, updatePlaylists));
//process the visible list first
tasks.add(0, tasks.remove(mViewPager.getCurrentItem()));
tasks.add(new Runnable() {
@Override
public void run() {
if (!mAdaptersToNotify.isEmpty())
display();
}
});
VLCApplication.runBackground(new Runnable() {
@Override
public void run() {
for (Runnable task : tasks)
task.run();
}
});
}
}