本文整理匯總了Java中org.teleal.cling.support.model.BrowseFlag類的典型用法代碼示例。如果您正苦於以下問題:Java BrowseFlag類的具體用法?Java BrowseFlag怎麽用?Java BrowseFlag使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BrowseFlag類屬於org.teleal.cling.support.model包,在下文中一共展示了BrowseFlag類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ContentBrowseCallback
import org.teleal.cling.support.model.BrowseFlag; //導入依賴的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;
}
示例2: browse
import org.teleal.cling.support.model.BrowseFlag; //導入依賴的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;
}
示例3: BrowseCallback
import org.teleal.cling.support.model.BrowseFlag; //導入依賴的package包/類
public BrowseCallback(String prefix, Service<?, ?> service, String containerId) {
super(service, containerId, BrowseFlag.DIRECT_CHILDREN, "*", 0, null, new SortCriterion(true, "dc:title"));
mService = service;
mPrefix = mPrefix + prefix + "/";
}
示例4: BrowseCallback
import org.teleal.cling.support.model.BrowseFlag; //導入依賴的package包/類
public BrowseCallback(String prefix, Service<?, ?> service, String containerId) {
super(service, containerId, BrowseFlag.DIRECT_CHILDREN, "*", 0, null, new SortCriterion(true, "dc:title"));
mService = service;
mPrefix = prefix;
}