當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。