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


Java Observable.fromCallable方法代码示例

本文整理汇总了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;
        }
    });
}
 
开发者ID:AlexeyZatsepin,项目名称:CP-Tester,代码行数:22,代码来源:MainActivity.java

示例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();
        }
    });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:AppDbHelper.java

示例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);
        }
    });
}
 
开发者ID:MindorksOpenSource,项目名称:android-mvp-interactor-architecture,代码行数:9,代码来源:OptionRepository.java

示例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();
        }
    });
}
 
开发者ID:MindorksOpenSource,项目名称:android-mvp-interactor-architecture,代码行数:9,代码来源:UserRepository.java

示例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);
        }
    });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:AppDbHelper.java

示例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;
        }
    });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:AppDbHelper.java

示例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;
        }
    });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:AppDbHelper.java

示例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();
        }
    });
}
 
开发者ID:MindorksOpenSource,项目名称:android-mvvm-architecture,代码行数:10,代码来源:AppDbHelper.java

示例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;
        }
    });
}
 
开发者ID:MindorksOpenSource,项目名称:android-mvvm-architecture,代码行数:11,代码来源:AppDbHelper.java

示例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();
        }
    });
}
 
开发者ID:vicky7230,项目名称:Paprika,代码行数:10,代码来源:AppDbHelper.java

示例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;
        }
    });
}
 
开发者ID:vicky7230,项目名称:Paprika,代码行数:11,代码来源:AppDbHelper.java

示例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;
        }
    });
}
 
开发者ID:MindorksOpenSource,项目名称:android-mvvm-architecture,代码行数:11,代码来源:AppDbHelper.java

示例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();
    }
  });
}
 
开发者ID:nikacotAndroid,项目名称:Weather-Guru-MVP,代码行数:11,代码来源:AppDbHelper.java

示例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();
        }
    });
}
 
开发者ID:vicky7230,项目名称:Paprika,代码行数:10,代码来源:AppDbHelper.java

示例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;

        }
    });
}
 
开发者ID:ansh94,项目名称:DailyTech,代码行数:12,代码来源:AppDbHelper.java


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