APISonar


rx.schedulers.Schedulers.io

> rx > schedulers > Schedulers > io
rx APIs schedulers APIs Schedulers APIs io APIs

Example 1
public static Observable<List<PhotoInfo>> getPhotoMoreList(String setId) {
        return sNewsService.getPhotoMoreList(setId)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .subscribeOn(AndroidSchedulers.mainThread())
                .observeOn(AndroidSchedulers.mainThread());
    }
Example 2
protected  <T> Observable<T> observe(Observable<T> observable){
        return observable.subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
Example 3
public @NonNull Observable<Category> fetchCategory(final @NonNull String id) {
    return this.service
      .category(id)
      .lift(apiErrorOperator())
      .subscribeOn(Schedulers.io());
  }
Example 4
public Observable<ThreadInfo> getThreadInfo(String fid, String tid) {
        return mForumApi.getThreadInfo(tid, fid, 1, "")
                .onErrorReturn(new Func1<Throwable, ThreadInfo>() {
                    @Override
                    public ThreadInfo call(Throwable throwable) {
                        return null;
                    }
                })
                .subscribeOn(Schedulers.io());
    }
Example 5
Observable<Vector<ContentValues>> getCommentsFromStory(Long storyId) {
        return Observable.create(
                new CommentsUpdateOnSubscribe(storyId))
                .subscribeOn(Schedulers.io());
    }
Example 6
public static Observable<SpecialInfo> getSpecial(String specialId) {
        return sNewsService.getSpecial(specialId)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .subscribeOn(AndroidSchedulers.mainThread())
                .observeOn(AndroidSchedulers.mainThread())
                .flatMap(_flatMapSpecial(specialId));
    }
Example 7
public static Observable<List<VideoInfo>> getVideoList(String videoId, int page) {
        return sNewsService.getVideoList(videoId, page * INCREASE_PAGE / 2)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .subscribeOn(AndroidSchedulers.mainThread())
                .observeOn(AndroidSchedulers.mainThread())
                .flatMap(_flatMapVideo(videoId));
    }
Example 8
public @NonNull Observable<Location> fetchLocation(final @NonNull String param) {
    return this.service.location(param)
      .subscribeOn(Schedulers.io())
      .lift(apiErrorOperator());
  }
Example 9
private static <T> Observable<T> mockClient(T... ts) {
        return Observable.create((Subscriber<? super T> s) -> {
            // simulate latency
                try {
                    Thread.sleep(1000);
                } catch (Exception e) {
                }
                for (T t : ts) {
                    s.onNext(t);
                }
                s.onCompleted();
            }).subscribeOn(Schedulers.io());
        // note the use of subscribeOn to make an otherwise synchronous Observable async
    }
Example 10
public void downloadFile(View view) {
        subscription = getObservable()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(getObserver());
    }
Example 11
public void deleteCity(String cityId) {

        Observable.just(deleteCityFromDBAndReturnCurrentCityId(cityId))
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(currentCityId -> {
                    if (currentCityId == null)
                        return;
                    try {
                        PreferenceHelper.savePreference(WeatherSettings.SETTINGS_CURRENT_CITY_ID, currentCityId);
                    } catch (InvalidClassException e) {
                        e.printStackTrace();
                    }
                });
    }
Example 12
private void checkNotifications(String name, String token) {
    if (name != null && token != null) {
      final NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
      notificationManager.cancel(token.hashCode());

      GetNotificationsClient notificationsClient = new GetNotificationsClient(token);
      subscription = notificationsClient.observable()
          .subscribeOn(Schedulers.io())
          .observeOn(Schedulers.io())
          .subscribe(this::onNotificationsReceived, Throwable::printStackTrace);
    }
  }
Example 13
public Observable<Integer> deleteOne(SandPhoto sandPhoto) {
        return Observable.just(sandPhoto)
                .subscribeOn(Schedulers.io())
                .map(sandPhoto1 -> mSandBoxDB.delete(sandPhoto1));
    }
Example 14
private static Action0 asAsyncAction(final Action0 action0) {
        return new Action0() {
            @Override
            public void call() {
                asObservable(action0)
                        .subscribeOn(Schedulers.io())
                        .subscribe();
            }
        };
    }
Example 15
public static Observable<NewsInfo> getNewsList(String newsId, int page) {
        String type;
        if (newsId.equals(HEAD_LINE_NEWS)) {
            type = "headline";
        } else {
            type = "list";
        }
        return sNewsService.getNewsList(type, newsId, page * INCREASE_PAGE)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .subscribeOn(AndroidSchedulers.mainThread())
                .observeOn(AndroidSchedulers.mainThread())
                .flatMap(_flatMapNews(newsId));
    }
Example 16
public void deleteWords(Result entity){
        deleteWordsByObservable(entity)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe((integer -> {
                    if (integer > 0) {
                        mView.deleteWordSuccess(entity);
                    } else {
                        mView.deleteWordFail();
                    }
                }), throwable -> {
                    mView.onError(throwable);
                });
    }
Example 17
public @NonNull Observable<ActivityEnvelope> fetchActivitiesWithPaginationPath(final @NonNull String paginationPath) {
    return this.service
      .activities(paginationPath)
      .lift(apiErrorOperator())
      .subscribeOn(Schedulers.io());
  }
Example 18
public static Observable<NewsDetailInfo> getNewsDetail(final String newsId) {
        return sNewsService.getNewsDetail(newsId)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .subscribeOn(AndroidSchedulers.mainThread())
                .observeOn(AndroidSchedulers.mainThread())
                .flatMap(new Func1<Map<String, NewsDetailInfo>, Observable<NewsDetailInfo>>() {
                    @Override
                    public Observable<NewsDetailInfo> call(Map<String, NewsDetailInfo> newsDetailMap) {
                        return Observable.just(newsDetailMap.get(newsId));
                    }
                });
    }
Example 19
public Subscription drop(final Handler handler) {
        return Schedulers.io().createWorker().schedule(new Action0() {
            @Override
            public void call() {
                try {
                    dropSynchronous();
                    handler.sendMessage(Message.obtain());
                } catch (final Exception e) {
                    Log.e("cache.drop: ", e);
                }
            }
        });
    }
Example 20
public void getBookById(IGetBookDetailView iGetBookView, String id ){

        doubanApi.getBookDetail(id)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(bookRoot -> {
                    disPlayBookDetail(iGetBookView,bookRoot);
                },this::loadError);


    }
Example 21
public static Observable<Boolean> recovery() {
        final File des = new File(Constant.EXTERNAL_STORAGE_DIRECTORY + Constant.DATABASE_FILE_PATH_FOLDER, Constant.DATABASE_FILE_PATH_FILE_NAME);
        final File src = new File(Constant.EXTERNAL_STORAGE_DIRECTORY + Constant.DATABASE_FILE_BACKUP_PATH_FOLDER, des.getName());
        return Observable
                .fromCallable(new Callable<Boolean>() {
                    @Override
                    public Boolean call() throws Exception {
                        return copyFile(src, des);
                    }
                })
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
Example 22
Observable<Login> login(String username, String password) {
        return Observable.create(
                new LoginOnSubscribe(username, password))
                .subscribeOn(Schedulers.io());
    }
Example 23
public Observable<Boolean> isLoginEvernote() {
        return Observable.create((Observable.OnSubscribe<Boolean>) subscriber -> {
            String name = mSharedPreferences.getString(EVERNOTE_NAME, NAME_DEFAULT);
            if (TextUtils.isEmpty(name)) {
                subscriber.onNext(false);
            } else {
                subscriber.onNext(true);
            }
            subscriber.onCompleted();
        }).subscribeOn(Schedulers.io());
    }
Example 24
private void requestData(String query) {
        unsubscribe();
        mSubscription = Network.getCityApi()
                .getCity("def9a507328e4cd395d983fe2589586e", query)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(mObserver);
    }
Example 25
protected void onResume() {
    super.onResume();
    diaryService.getDiaryList()
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(new Action1<List<Diary>>() {
          @Override
          public void call(List<Diary> diaries) {
            diaryList.clear();
            diaryList.addAll(diaries);
            adapter.notifyDataSetChanged();
          }
        });
  }