本文整理汇总了Java中io.reactivex.Observable.fromCallable方法的典型用法代码示例。如果您正苦于以下问题:Java Observable.fromCallable方法的具体用法?Java Observable.fromCallable怎么用?Java Observable.fromCallable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.Observable
的用法示例。
在下文中一共展示了Observable.fromCallable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProviders
import io.reactivex.Observable; //导入方法依赖的package包/类
private Observable<List<ProviderInfo>> getProviders(){
return Observable.fromCallable(new Callable<List<ProviderInfo>>() {
@Override public List<ProviderInfo> call() throws Exception {
List<ProviderInfo> info = new ArrayList<>();
for (PackageInfo providerInfo :getPackageManager().getInstalledPackages(PackageManager.GET_PROVIDERS)){
if (providerInfo.providers != null){
for (ProviderInfo provider : providerInfo.providers) {
if (provider.authority != null) {
if (sp.getBoolean("need_filter",false)){
info.add(provider);
}else if(provider.readPermission!=null){
info.add(provider);
}
}
}
}
}
return info;
}
});
}
示例2: getAllQuestions
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Observable<List<Question>> getAllQuestions() {
return Observable.fromCallable(new Callable<List<Question>>() {
@Override
public List<Question> call() throws Exception {
return mDaoSession.getQuestionDao().loadAll();
}
});
}
示例3: isOptionEmpty
import io.reactivex.Observable; //导入方法依赖的package包/类
public Observable<Boolean> isOptionEmpty() {
return Observable.fromCallable(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return !(mDaoSession.getOptionDao().count() > 0);
}
});
}
示例4: getAllQuestions
import io.reactivex.Observable; //导入方法依赖的package包/类
public Observable<List<Question>> getAllQuestions() {
return Observable.fromCallable(new Callable<List<Question>>() {
@Override
public List<Question> call() throws Exception {
return mDaoSession.getQuestionDao().loadAll();
}
});
}
示例5: isOptionEmpty
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Observable<Boolean> isOptionEmpty() {
return Observable.fromCallable(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return !(mDaoSession.getOptionDao().count() > 0);
}
});
}
示例6: saveQuestion
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Observable<Boolean> saveQuestion(final Question question) {
return Observable.fromCallable(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
mDaoSession.getQuestionDao().insert(question);
return true;
}
});
}
示例7: saveOption
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Observable<Boolean> saveOption(final Option option) {
return Observable.fromCallable(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
mDaoSession.getOptionDao().insertInTx(option);
return true;
}
});
}
示例8: isOptionEmpty
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Observable<Boolean> isOptionEmpty() {
return Observable.fromCallable(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return mAppDatabase.optionDao().loadAll().isEmpty();
}
});
}
示例9: saveOptionList
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Observable<Boolean> saveOptionList(final List<Option> optionList) {
return Observable.fromCallable(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
mAppDatabase.optionDao().insertAll(optionList);
return true;
}
});
}
示例10: checkIfRecipeIsAlreadyLiked
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Observable<List<LikedRecipe>> checkIfRecipeIsAlreadyLiked(final Recipe recipe) {
return Observable.fromCallable(new Callable<List<LikedRecipe>>() {
@Override
public List<LikedRecipe> call() throws Exception {
return daoSession.getLikedRecipeDao().queryBuilder().where(LikedRecipeDao.Properties.RecipeId.eq(recipe.getRecipeId())).list();
}
});
}
示例11: deleteLikedRecipe
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Observable<Boolean> deleteLikedRecipe(final LikedRecipe likedRecipe) {
return Observable.fromCallable(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
daoSession.getLikedRecipeDao().deleteByKey(likedRecipe.getId());
return true;
}
});
}
示例12: insertUser
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Observable<Boolean> insertUser(final User user) {
return Observable.fromCallable(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
mAppDatabase.userDao().insert(user);
return true;
}
});
}
示例13: getAllCities
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override public Observable<List<CityDetailsModel>> getAllCities() {
return Observable.fromCallable(new Callable<List<CityDetailsModel>>() {
@Override public List<CityDetailsModel> call() throws Exception {
return daoSession.getCityDetailsModelDao()
.queryBuilder()
.orderDesc(CityDetailsModelDao.Properties.Id)
.list();
}
});
}
示例14: getLastInsertedLikedRecipe
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Observable<List<LikedRecipe>> getLastInsertedLikedRecipe() {
return Observable.fromCallable(new Callable<List<LikedRecipe>>() {
@Override
public List<LikedRecipe> call() throws Exception {
return daoSession.getLikedRecipeDao().queryBuilder().orderDesc(LikedRecipeDao.Properties.Id).limit(1).list();
}
});
}
示例15: removeArticle
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Observable<Void> removeArticle(final Article article) {
return Observable.fromCallable(new Callable<Void>() {
@Override
public Void call() throws Exception {
mDaoSession.getArticleDao().delete(article);
return null;
}
});
}