当前位置: 首页>>代码示例>>Java>>正文


Java Container类代码示例

本文整理汇总了Java中org.teleal.cling.support.model.container.Container的典型用法代码示例。如果您正苦于以下问题:Java Container类的具体用法?Java Container怎么用?Java Container使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Container类属于org.teleal.cling.support.model.container包,在下文中一共展示了Container类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeItemsFormPath

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
public boolean removeItemsFormPath(String path) {
	boolean removeSuccess = false;
	File file = new File(path);
	if (file.isFile() || file.isDirectory()) {
		DIDLObject item = content.findObjectWithId(createId(path));
		if (item == null)
			return false;
		String parentId = item.getParentID();
		Container parent = (Container) content.findObjectWithId(parentId);
		removeSuccess = parent.getItems().remove(item);
		if (!removeSuccess) {
			removeSuccess = parent.getContainers().remove(item);
		}
		parent.setChildCount(parent.getChildCount() - 1);
	}
	return removeSuccess;
}
 
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:18,代码来源:RootContainer.java

示例2: onListItemClick

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
/**
 * Enters directory browsing mode or enters a deeper level directory.
 */
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
	if (getListAdapter() == mServerAdapter) {
		browsingMode(mServerAdapter.getItem(position));
	}
	else if (getListAdapter() == mFileAdapter) {
		if (mFileAdapter.getItem(position) instanceof Container)
			getFiles(((Container) mFileAdapter.getItem(position)).getId());
		else {
			List<Item> playlist = new ArrayList<Item>();
			for (int i = 0; i < mFileAdapter.getCount(); i++) {
				if (mFileAdapter.getItem(i) instanceof Item) {
					playlist.add((Item) mFileAdapter.getItem(i));
				}
			}
			MainActivity activity = (MainActivity) getActivity();
			activity.play(playlist, position);
		}
	}
}
 
开发者ID:Nutomic,项目名称:controldlna,代码行数:24,代码来源:ServerFragment.java

示例3: goBack

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
private void goBack() {
	if (mType != FileSource.UPNP)
		browse(GO_BACK, false);
	else {
		if (mBrowser == null)
			return;

		Container parentContainer = new Container();

		String id = "0";
		if (((BrowserUpnp) mBrowser).getContainer() != null) {
			id = ((BrowserUpnp) mBrowser).getParentId(((BrowserUpnp) mBrowser).getContainer().getId());
		}
		parentContainer.setId(id);

		if (((BrowserUpnp) mBrowser).getService() != null)
			upnpService.getControlPoint().execute(new ContentBrowseCallback(getActivity(), ((BrowserUpnp) mBrowser).getService(), parentContainer, contentListAdapter, false));
	}
}
 
开发者ID:MizzleDK,项目名称:Mizuu,代码行数:20,代码来源:FileSourceBrowserFragment.java

示例4: received

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public void received(ActionInvocation arg0, DIDLContent didl) {
    try {
        for (Container childContainer : didl.getContainers()) {
            mFolderCount++;
            mUpnpService.getControlPoint().execute(new BrowseCallback((mPrefix.startsWith("/") ? mPrefix : "/" + mPrefix) + childContainer.getTitle(), mService, childContainer.getId()));
        }

        for (Item childItem : didl.getItems()) {
            addToResults(mPrefix + childItem.getTitle() + "<MiZ>" + childItem.getFirstResource().getValue(), childItem.getFirstResource().getSize(), results);
        }

        mScannedCount++;

        if (mFolderCount == mScannedCount) {
            mLatch.countDown();
            mContext.unbindService(serviceConnection);
        }

    } catch (Exception e) {}
}
 
开发者ID:MizzleDK,项目名称:Mizuu,代码行数:23,代码来源:UpnpTvShow.java

示例5: received

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public void received(ActionInvocation arg0, DIDLContent didl) {
	try {
		for (Container childContainer : didl.getContainers()) {
			mFolderCount++;
			mUpnpService.getControlPoint().execute(new BrowseCallback(mPrefix + "/" + childContainer.getTitle(), mService, childContainer.getId()));
		}

		for (Item childItem : didl.getItems()) {
			addToResults(mPrefix + "/" + childItem.getTitle() + "<MiZ>" + childItem.getFirstResource().getValue(), childItem.getFirstResource().getSize(), results);
		}

		mScannedCount++;

		if (mFolderCount == mScannedCount) {
			mLatch.countDown();
			mContext.unbindService(serviceConnection);
		}

	} catch (Exception e) {}
}
 
开发者ID:MizzleDK,项目名称:Mizuu,代码行数:23,代码来源:UpnpMovie.java

示例6: findObjectWithId

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
public DIDLObject findObjectWithId(String id) {
	for (Container container : getContainers()) {
		if (container.getId().equals(id))
			return container;
		DIDLObject obj = findObjectWithId(id, container);
		if (obj != null)
			return obj;
	}
	return null;
}
 
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:11,代码来源:MediaStoreContent.java

示例7: CustomContainer

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
public CustomContainer(Container parent, String id, String title) {
	setId(id);
	setParentID(parent.getId());
	setTitle(title);
	setCreator(MediaStoreContent.CREATOR);
	setClazz(MediaStoreContent.CLASS_CONTAINER);
	setRestricted(true);
	setSearchable(false);
	setWriteStatus(WriteStatus.NOT_WRITABLE);
}
 
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:11,代码来源:OtherContainer.java

示例8: startBrowse

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
private void startBrowse(Device<?, ?, ?> device) {
	Service<?, ?> service = device.findService(new UDAServiceType("ContentDirectory"));
	((BrowserUpnp) mBrowser).setService(service);

	Container rootContainer = new Container();
	rootContainer.setId("0");
	rootContainer.setTitle(device.getDetails().getFriendlyName());

	upnpService.getControlPoint().execute(new ContentBrowseCallback(getActivity(), service, rootContainer, contentListAdapter, true));
}
 
开发者ID:MizzleDK,项目名称:Mizuu,代码行数:11,代码来源:FileSourceBrowserFragment.java

示例9: ContentBrowseCallback

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public ContentBrowseCallback(Activity activity, Service service, Container container, ArrayAdapter<ContentItem> listadapter, boolean addToStack) {
	super(service, container.getId(), BrowseFlag.DIRECT_CHILDREN, "*", 0, null, new SortCriterion(true, "dc:title"));
	this.activity = activity;
	this.service = service;
	this.listAdapter = listadapter;

	mContainer = container;
}
 
开发者ID:MizzleDK,项目名称:Mizuu,代码行数:10,代码来源:FileSourceBrowserFragment.java

示例10: received

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public void received(final ActionInvocation actionInvocation, final DIDLContent didl) {
	if (activity != null)
		activity.runOnUiThread(new Runnable() {
			public void run() {
				try {
					listAdapter.clear();
					
					// Containers first
					for (Container childContainer : didl.getContainers()) {
						listAdapter.add(new ContentItem(childContainer, service));
					}
					// Now items
					for (Item childItem : didl.getItems()) {
						listAdapter.add(new ContentItem(childItem, service));
					}

					((BrowserUpnp) mBrowser).setContainer(mContainer);

					((BrowserUpnp) mBrowser).addParentId(mContainer.getId(), mContainer.getParentID());

					mLoading = false;
				} catch (Exception ex) {
					mLoading = false;
				}
			}
		});
}
 
开发者ID:MizzleDK,项目名称:Mizuu,代码行数:29,代码来源:FileSourceBrowserFragment.java

示例11: getContainer

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
public Container getContainer() {
	if(isContainer)
		return (Container) content;
	else {
		return null;
	}
}
 
开发者ID:MizzleDK,项目名称:Mizuu,代码行数:8,代码来源:ContentItem.java

示例12: browse

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
@Override
public BrowseResult browse(String objectID, BrowseFlag browseFlag,
		String filter, long firstResult, long maxResults,
		SortCriterion[] orderby) throws ContentDirectoryException {
	log.info("browseId --> " + objectID);
	log.info("browseFlag --> " + browseFlag);

	DIDLContent didl = new DIDLContent();
	try {
		if (!content.isShareEnable()) {
			log.info("dms will not share anything.");
			return new BrowseResult(new DIDLParser().generate(didl), 0, 0);
		}
		DIDLObject object = content.findObjectWithId(objectID);
		if (object == null) {
			log.info("object not found:" + objectID);
			return new BrowseResult(new DIDLParser().generate(didl), 0, 0);
		}
		log.info("find object. id-->" + object.getId() + " title-->"
				+ object.getTitle());
		int count = 0;
		int totalMatches = 0;
		if (browseFlag.equals(BrowseFlag.METADATA)) {
			if (object instanceof Container) {
				log.info("Browsing metadata of container: "
						+ object.getId());
				didl.addContainer((Container) object);
				count++;
				totalMatches++;
			} else if (object instanceof Item) {
				log.info("Browsing metadata of item: " + object.getId());
				didl.addItem((Item) object);
				count++;
				totalMatches++;
			}
		} else if (browseFlag.equals(BrowseFlag.DIRECT_CHILDREN)) {
			if (object instanceof Container) {
				log.info("Browsing children of container: "
						+ object.getId());
				Container container = (Container) object;
				boolean maxReached = maxResults == 0;
				totalMatches = totalMatches
						+ container.getContainers().size();
				for (Container subContainer : container.getContainers()) {
					if (maxReached)
						break;
					if (firstResult > 0 && count == firstResult)
						continue;
					didl.addContainer(subContainer);
					count++;
					if (count >= maxResults)
						maxReached = true;
				}
				totalMatches = totalMatches + container.getItems().size();
				for (Item item : container.getItems()) {
					if (maxReached)
						break;
					if (firstResult > 0 && count == firstResult)
						continue;
					didl.addItem(item);
					count++;
					if (count >= maxResults)
						maxReached = true;
				}
			}
		}
		log.info("Browsing result count: " + count + " and total matches: "
				+ totalMatches);
		return new BrowseResult(new DIDLParser().generate(didl), count,
				totalMatches);
	} catch (Exception e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:76,代码来源:ContentDirectory.java

示例13: removeAllShareFile

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
public boolean removeAllShareFile() {
	setContainers(new ArrayList<Container>());
	RootContainer root = new RootContainer(this);
	addContainer(root);
	return true;
}
 
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:7,代码来源:MediaStoreContent.java

示例14: createContainer

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
private CustomContainer createContainer(File file, Container parent) {
	return new CustomContainer(parent, createId(file.getPath()),
			file.getName());
}
 
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:5,代码来源:RootContainer.java

示例15: setContainer

import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
public void setContainer(Container container) {
	mContainer = container;
}
 
开发者ID:MizzleDK,项目名称:Mizuu,代码行数:4,代码来源:BrowserUpnp.java


注:本文中的org.teleal.cling.support.model.container.Container类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。