本文整理汇总了Java中org.jdeferred.impl.DefaultDeferredManager类的典型用法代码示例。如果您正苦于以下问题:Java DefaultDeferredManager类的具体用法?Java DefaultDeferredManager怎么用?Java DefaultDeferredManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultDeferredManager类属于org.jdeferred.impl包,在下文中一共展示了DefaultDeferredManager类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: get
import org.jdeferred.impl.DefaultDeferredManager; //导入依赖的package包/类
@Override
public DeferredManager get() {
return new DefaultDeferredManager(executorService);
}
开发者ID:aalmiray,项目名称:javatrove,代码行数:5,代码来源:DeferredManagerProvider.java
示例2: getEntriesAsync
import org.jdeferred.impl.DefaultDeferredManager; //导入依赖的package包/类
@Override
Promise<Object, Throwable, Void> getEntriesAsync(Context context) {
MyPackageManager myPackageManager = MyPackageManagerImpl.getInstance(context);
Promise<Collection<MyPackageInfo>, Void, Void> packagesPromise = myPackageManager.getPackages(false);
Promise<Map<String, MyPermissionInfo>, Void, Void> permissionsPromise = myPackageManager.getPermissions();
DefaultDeferredManager dm = new DefaultDeferredManager();
final PackageManager pm = context.getPackageManager();
return dm
.when(packagesPromise, permissionsPromise)
.then(new DoneFilter<MultipleResults, Object>() {
@Override
public Object filterDone(MultipleResults result) {
@SuppressWarnings("unchecked")
Collection<MyPackageInfo> packages = (Collection<MyPackageInfo>) result.get(0).getResult();
@SuppressWarnings("unchecked")
Map<String, MyPermissionInfo> permissions = (Map<String, MyPermissionInfo>) result.get(1).getResult();
ArrayList<Category> selectedApps = new ArrayList<Category>();
//
for (MyPackageInfo pack : packages) {
// System app filter
if (((
pack.isSystemApplication() ?
APP_TYPE_SYSTEM :
APP_TYPE_USER)
& appType) == 0) {
continue;
}
// Scan components
ArrayList<Component> selectedComponents = new ArrayList<Component>();
if ((type & PackageManager.GET_ACTIVITIES) != 0) {
scanComponents(permissions, pack.getActivities(), selectedComponents, false);
}
if ((type & PackageManager.GET_RECEIVERS) != 0) {
scanComponents(permissions, pack.getReceivers(), selectedComponents, false);
}
if ((type & PackageManager.GET_SERVICES) != 0) {
scanComponents(permissions, pack.getServices(), selectedComponents, false);
}
if ((type & PackageManager.GET_PROVIDERS) != 0) {
scanComponents(permissions, pack.getProviders(), selectedComponents, testWritePermissionForProviders);
}
// Check if we filtered out all components and skip whole app if so
if (selectedComponents.isEmpty()) {
continue;
}
// Build and add app descriptor
Category app = new Category();
app.title = String.valueOf(pack.loadLabel(pm));
app.subtitle = pack.getPackageName();
app.components = selectedComponents.toArray(new Component[selectedComponents.size()]);
selectedApps.add(app);
}
Category[] selectedAppsArray = selectedApps.toArray(new Category[selectedApps.size()]);
Arrays.sort(selectedAppsArray, new Comparator<Category>() {
@Override
public int compare(Category lhs, Category rhs) {
return lhs.subtitle.compareTo(rhs.subtitle);
}
});
return selectedAppsArray;
}
});
}
开发者ID:michalbednarski,项目名称:IntentsLab,代码行数:72,代码来源:ComponentFetcher.java
注:本文中的org.jdeferred.impl.DefaultDeferredManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论