本文整理匯總了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;
}
});
}