io.reactivex.SingleOnSubscribe Java Examples
The following examples show how to use
io.reactivex.SingleOnSubscribe.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlayListPresenterImpl.java From Android-AudioRecorder-App with Apache License 2.0 | 6 votes |
private Single<Integer> rename(RecordingItem recordingItem, int adapterPosition, String name) { return Single.create((SingleOnSubscribe<Integer>) e -> { File newFile = new File( Environment.getExternalStorageDirectory().getAbsolutePath() + "/SoundRecorder/" + name); if (newFile.exists() && !newFile.isDirectory()) { e.onError(new Exception("File with same name already exists")); } else { File oldFilePath = new File(recordingItem.getFilePath()); if (oldFilePath.renameTo(newFile)) { recordingItem.setName(name); recordingItem.setFilePath(newFile.getPath()); recordItemDataSource.updateRecordItem(recordingItem); e.onSuccess(adapterPosition); } else { e.onError(new Throwable("Cannot Rename file. Please try again")); } } }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()); }
Example #2
Source File: ValidatorPresenter.java From rootvalidator with GNU General Public License v3.0 | 6 votes |
void onTestAll() { onView(View::showWorking); Single.create((SingleOnSubscribe<List<TestResult>>) emitter -> { Timber.d("loadInBackground start..."); long dur = System.currentTimeMillis(); ArrayList<TestResult> results = new ArrayList<>(); for (TestSuite suite : tests) { results.addAll(suite.test().blockingGet()); } Timber.d("loadInBackground done: %dms", (System.currentTimeMillis() - dur)); emitter.onSuccess(results); }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnSuccess(testInfos -> ValidatorPresenter.this.testData = testInfos) .subscribe(testInfos -> onView(v -> v.display(testInfos))); }
Example #3
Source File: RxDatabaseReference.java From rxfirebase with Apache License 2.0 | 6 votes |
/** * @param query * @return */ @NonNull @CheckReturnValue public static Single<DataSnapshot> single(@NonNull final Query query) { return Single.create(new SingleOnSubscribe<DataSnapshot>() { @Override public void subscribe( @NonNull final SingleEmitter<DataSnapshot> emit) throws Exception { final ValueEventListener listener = listener(emit); emit.setCancellable(new Cancellable() { @Override public void cancel() throws Exception { query.removeEventListener(listener); } }); query.addListenerForSingleValueEvent(listener); } }); }
Example #4
Source File: BookmarkFragment.java From MyBookshelf with GNU General Public License v3.0 | 6 votes |
@Override protected void firstRequest() { super.firstRequest(); Single.create((SingleOnSubscribe<Boolean>) emitter -> { if (bookShelf != null) { bookmarkBeanList = BookshelfHelp.getBookmarkList(bookShelf.getBookInfoBean().getName()); emitter.onSuccess(true); } else { emitter.onSuccess(false); } }).compose(RxUtils::toSimpleSingle) .subscribe(new MySingleObserver<Boolean>() { @Override public void onSuccess(Boolean aBoolean) { if (aBoolean) { adapter.setAllBookmark(bookmarkBeanList); } } }); }
Example #5
Source File: RealListStore.java From RxStore with Apache License 2.0 | 6 votes |
@Override @NonNull public Single<List<T>> observePut(@NonNull final List<T> list) { assertNotNull(list, "list"); return Single.create(new SingleOnSubscribe<List<T>>() { @Override public void subscribe(final SingleEmitter<List<T>> emitter) throws Exception { runInWriteLock(readWriteLock, new ThrowingRunnable() { @Override public void run() throws Exception { if (!file.exists() && !file.createNewFile()) { throw new IOException("Could not create file for store."); } converterWrite(list, converter, type, file); emitter.onSuccess(list); updateSubject.onNext(list); } }); } }); }
Example #6
Source File: RealListStore.java From RxStore with Apache License 2.0 | 6 votes |
@Override @NonNull public Single<List<T>> observeClear() { return Single.create(new SingleOnSubscribe<List<T>>() { @Override public void subscribe(final SingleEmitter<List<T>> emitter) throws Exception { runInWriteLock(readWriteLock, new ThrowingRunnable() { @Override public void run() throws Exception { if (file.exists() && !file.delete()) { throw new IOException("Clear operation on store failed."); } emitter.onSuccess(Collections.<T>emptyList()); updateSubject.onNext(Collections.<T>emptyList()); } }); } }); }
Example #7
Source File: RealListStore.java From RxStore with Apache License 2.0 | 6 votes |
@Override @NonNull public Single<List<T>> observeAdd(@NonNull final T value) { assertNotNull(value, "value"); return Single.create(new SingleOnSubscribe<List<T>>() { @Override public void subscribe(final SingleEmitter<List<T>> emitter) throws Exception { runInWriteLock(readWriteLock, new ThrowingRunnable() { @Override public void run() throws Exception { if (!file.exists() && !file.createNewFile()) { throw new IOException("Could not create file for store."); } List<T> originalList = converter.read(file, type); if (originalList == null) originalList = Collections.emptyList(); List<T> result = new ArrayList<T>(originalList.size() + 1); result.addAll(originalList); result.add(value); converterWrite(result, converter, type, file); emitter.onSuccess(result); updateSubject.onNext(result); } }); } }); }
Example #8
Source File: RealListStore.java From RxStore with Apache License 2.0 | 6 votes |
@Override @NonNull public Single<List<T>> observeRemove(final int position) { return Single.create(new SingleOnSubscribe<List<T>>() { @Override public void subscribe(final SingleEmitter<List<T>> emitter) throws Exception { runInWriteLock(readWriteLock, new ThrowingRunnable() { @Override public void run() throws Exception { List<T> originalList = converter.read(file, type); if (originalList == null) originalList = Collections.emptyList(); List<T> modifiedList = new ArrayList<T>(originalList); modifiedList.remove(position); converterWrite(modifiedList, converter, type, file); emitter.onSuccess(modifiedList); updateSubject.onNext(modifiedList); } }); } }); }
Example #9
Source File: BookmarkFragment.java From a with GNU General Public License v3.0 | 6 votes |
@Override protected void firstRequest() { super.firstRequest(); Single.create((SingleOnSubscribe<Boolean>) emitter -> { if (bookShelf != null) { bookmarkBeanList = BookshelfHelp.getBookmarkList(bookShelf.getBookInfoBean().getName()); emitter.onSuccess(true); } else { emitter.onSuccess(false); } }).compose(RxUtils::toSimpleSingle) .subscribe(new MySingleObserver<Boolean>() { @Override public void onSuccess(Boolean aBoolean) { if (aBoolean) { adapter.setAllBookmark(bookmarkBeanList); } } }); }
Example #10
Source File: RealListStore.java From RxStore with Apache License 2.0 | 6 votes |
@Override @NonNull public Single<List<T>> get() { return Single.create(new SingleOnSubscribe<List<T>>() { @Override public void subscribe(final SingleEmitter<List<T>> emitter) throws Exception { runInReadLock(readWriteLock, new ThrowingRunnable() { @Override public void run() throws Exception { if (!file.exists()) { emitter.onSuccess(Collections.<T>emptyList()); return; } List<T> list = converter.read(file, type); if (list == null) list = Collections.emptyList(); emitter.onSuccess(list); } }); } }); }
Example #11
Source File: RxValue.java From rxfirebase with Apache License 2.0 | 6 votes |
/** * @param query * @return */ @NonNull @CheckReturnValue public static Single<DataSnapshot> single(@NonNull final Query query) { return Single.create(new SingleOnSubscribe<DataSnapshot>() { @Override public void subscribe( @NonNull final SingleEmitter<DataSnapshot> emit) throws Exception { final ValueEventListener listener = listener(emit); emit.setCancellable(new Cancellable() { @Override public void cancel() throws Exception { query.removeEventListener(listener); } }); query.addListenerForSingleValueEvent(listener); } }); }
Example #12
Source File: Rx2Apollo.java From apollo-android with MIT License | 6 votes |
/** * Converts an {@link ApolloStoreOperation} to a Single. * * @param operation the ApolloStoreOperation to convert * @param <T> the value type * @return the converted Single */ @NotNull @CheckReturnValue public static <T> Single<T> from(@NotNull final ApolloStoreOperation<T> operation) { checkNotNull(operation, "operation == null"); return Single.create(new SingleOnSubscribe<T>() { @Override public void subscribe(final SingleEmitter<T> emitter) { operation.enqueue(new ApolloStoreOperation.Callback<T>() { @Override public void onSuccess(T result) { emitter.onSuccess(result); } @Override public void onFailure(Throwable t) { emitter.onError(t); } }); } }); }
Example #13
Source File: RxPermissions.java From RuntimePermission with Apache License 2.0 | 6 votes |
/** * use only request with an empty array to request all manifest permissions */ public Single<PermissionResult> requestAsSingle(final List<String> permissions) { return Single.create(new SingleOnSubscribe<PermissionResult>() { @Override public void subscribe(final SingleEmitter<PermissionResult> emitter) throws Exception { runtimePermission .request(permissions) .onResponse(new ResponseCallback() { @Override public void onResponse(PermissionResult result) { if (result.isAccepted()) { emitter.onSuccess(result); } else { emitter.onError(new Error(result)); } } }).ask(); } }); }
Example #14
Source File: RxQuery.java From ObjectBoxRxJava with Apache License 2.0 | 6 votes |
/** * The returned Single emits one Query result as a List. */ public static <T> Single<List<T>> single(final Query<T> query) { return Single.create(new SingleOnSubscribe<List<T>>() { @Override public void subscribe(final SingleEmitter<List<T>> emitter) throws Exception { query.subscribe().single().observer(new DataObserver<List<T>>() { @Override public void onData(List<T> data) { if (!emitter.isDisposed()) { emitter.onSuccess(data); } } }); // no need to cancel, single never subscribes } }); }
Example #15
Source File: RxProcess.java From RxShell with Apache License 2.0 | 6 votes |
public Session(Process process, Disposable processDisposable) { this.process = process; this.destroy = Completable .create(e -> { processDisposable.dispose(); e.onComplete(); }) .subscribeOn(Schedulers.io()) .doOnComplete(() -> { if (RXSDebug.isDebug()) Timber.tag(TAG).v("destroy():doOnComplete");}) .doOnError(t -> { if (RXSDebug.isDebug()) Timber.tag(TAG).v(t, "destroy():doOnError");}) .cache(); this.waitFor = Single .create((SingleOnSubscribe<Integer>) e -> { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Waiting for %s to exit.", process); int exitCode = process.waitFor(); if (RXSDebug.isDebug()) Timber.tag(TAG).d("Exitcode: %d, Process: %s", exitCode, process); e.onSuccess(exitCode); }) .subscribeOn(Schedulers.io()) .doOnSuccess(s -> { if (RXSDebug.isDebug()) Timber.tag(TAG).v("waitFor():doOnSuccess %s", s);}) .doOnError(t -> { if (RXSDebug.isDebug()) Timber.tag(TAG).v(t, "waitFor():doOnError");}) .cache(); }
Example #16
Source File: CmdProcessor.java From RxShell with Apache License 2.0 | 6 votes |
public Single<Cmd.Result> submit(Cmd cmd) { return Single.create((SingleOnSubscribe<Cmd.Result>) emitter -> { QueueCmd item = new QueueCmd(cmd, emitter); synchronized (CmdProcessor.this) { if (dead) { if (RXSDebug.isDebug()) Timber.tag(TAG).w("Processor wasn't running: %s", cmd); item.exitCode(Cmd.ExitCode.SHELL_DIED); item.emit(); } else { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Submitted: %s", cmd); cmdQueue.add(item); } } }).doOnSuccess(item -> { if (RXSDebug.isDebug()) { Timber.tag(TAG).log(item.getErrors() != null && item.getErrors().size() > 0 ? Log.WARN : Log.INFO, "Processed: %s", item); } }); }
Example #17
Source File: MaybeConsumers.java From science-journal with Apache License 2.0 | 6 votes |
/** * Given an operation that takes a {@link MaybeConsumer<T>}, create a JavaRX {@link Single<T>} * that produces the value passed to the MaybeConsumer. * * <p>Example: * * <pre> * // log the name of the experiment with a given id * DataController dc = getDataController(); * MaybeConsumers.buildSingle(mc -> dc.getExperimentById(id, mc)) * .subscribe(experiment -> log("Name: " + experiment.getName())); * </pre> */ public static <T> Single<T> buildSingle(io.reactivex.functions.Consumer<MaybeConsumer<T>> c) { return Single.create( new SingleOnSubscribe<T>() { @Override public void subscribe(SingleEmitter<T> emitter) throws Exception { c.accept( new MaybeConsumer<T>() { @Override public void success(T value) { emitter.onSuccess(value); } @Override public void fail(Exception e) { emitter.onError(e); } }); } }); }
Example #18
Source File: RxActionDelegate.java From pandroid with Apache License 2.0 | 6 votes |
public static <T> Single<Result<T>> singleWrapped(final OnSubscribeAction<T> subscribe) { return Single.<Result<T>>create(new SingleOnSubscribe<Result<T>>() { @Override public void subscribe(final SingleEmitter<Result<T>> emitter) throws Exception { final RxActionDelegate<T> delegate = new RxActionDelegate<>(new ActionDelegate<T>() { @Override public void onSuccess(T result) { emitter.onSuccess(new Result<T>(result)); } @Override public void onError(Exception e) { emitter.onSuccess(new Result<T>(e)); } }); emitter.setDisposable(delegate); subscribe.subscribe(delegate); } }); }
Example #19
Source File: RxActionDelegate.java From pandroid with Apache License 2.0 | 6 votes |
public static <T> Single<T> single(final OnSubscribeAction<T> subscribe) { return Single.<T>create(new SingleOnSubscribe<T>() { @Override public void subscribe(final SingleEmitter<T> emitter) throws Exception { RxActionDelegate<T> delegate = new RxActionDelegate<>(new ActionDelegate<T>() { @Override public void onSuccess(T result) { emitter.onSuccess(result); } @Override public void onError(Exception e) { emitter.onError(e); } }); emitter.setDisposable(delegate); subscribe.subscribe(delegate); } }); }
Example #20
Source File: BookRepository.java From NovelReader with MIT License | 6 votes |
/************************************************************/ public Single<Void> deleteCollBookInRx(CollBookBean bean) { return Single.create(new SingleOnSubscribe<Void>() { @Override public void subscribe(SingleEmitter<Void> e) throws Exception { //查看文本中是否存在删除的数据 deleteBook(bean.get_id()); //删除任务 deleteDownloadTask(bean.get_id()); //删除目录 deleteBookChapter(bean.get_id()); //删除CollBook mCollBookDao.delete(bean); e.onSuccess(new Void()); } }); }
Example #21
Source File: DataService.java From android-mvvm with Apache License 2.0 | 6 votes |
public Single<Result<String>> loadData() { return Single.create(new SingleOnSubscribe<Result<String>>() { @Override public void subscribe(SingleEmitter<Result<String>> e) throws Exception { try { Thread.sleep(3000); } catch (InterruptedException ex) { ex.printStackTrace(); } if (new Random().nextBoolean()) { e.onSuccess(Result.success("Result from data service")); } else { e.onSuccess(Result.<String>error(new Throwable("Fake error"))); } } }).subscribeOn(Schedulers.computation()).observeOn(AndroidSchedulers.mainThread()); }
Example #22
Source File: AbstractQuery.java From Android-OkGraphQl with Apache License 2.0 | 6 votes |
public Single<T> toSingle() { return Single.create(new SingleOnSubscribe<T>() { @Override public void subscribe(final @NonNull SingleEmitter<T> e) throws Exception { enqueue(new Callback<T>() { @Override public void onResponse(@NonNull T data) { e.onSuccess(data); } } , new ErrorCallback() { @Override public void onError(@NonNull Throwable error) { e.onError(error); } } ); } }); }
Example #23
Source File: RealValueStore.java From RxStore with Apache License 2.0 | 6 votes |
@Override @NonNull public Single<T> observePut(@NonNull final T value) { assertNotNull(value, "value"); return Single.create(new SingleOnSubscribe<T>() { @Override public void subscribe(final SingleEmitter<T> emitter) throws Exception { runInWriteLock(readWriteLock, new ThrowingRunnable() { @Override public void run() throws Exception { if (!file.exists() && !file.createNewFile()) { throw new IOException("Could not create file for store."); } converterWrite(value, converter, type, file); emitter.onSuccess(value); updateSubject.onNext(new ValueUpdate<T>(value)); } }); } }); }
Example #24
Source File: AllocineApi.java From Android-Allocine-Api with Apache License 2.0 | 5 votes |
public Single<List<Theater>> theaterList(final String lat, final String lng, final int radius, final int count, final int page) { return Single .create(new SingleOnSubscribe<Pair<String, String>>() { @Override public void subscribe(SingleEmitter<Pair<String, String>> e) throws Exception { final String params = ServiceSecurity.construireParams(false, AllocineService.LAT, lat, AllocineService.LONG, lng, AllocineService.RADIUS, "" + radius, AllocineService.COUNT, "" + count, AllocineService.PAGE, "" + page ); final String sed = ServiceSecurity.getSED(); final String sig = ServiceSecurity.getSIG(params, sed); e.onSuccess(Pair.create(sed, sig)); } }) .flatMap(new Function<Pair<String, String>, SingleSource<? extends List<Theater>>>() { @Override public SingleSource<? extends List<Theater>> apply(Pair<String, String> pair) throws Exception { return allocineService.theaterlist(lat, lng, radius, count, page, pair.first, pair.second) .map(new Function<AllocineResponse, List<Theater>>() { @Override public List<Theater> apply(AllocineResponse allocineResponse) throws Exception { return allocineResponse.getFeed().getTheater(); } }); } }) .compose(this.<List<Theater>>retry()); }
Example #25
Source File: AllocineApi.java From Android-Allocine-Api with Apache License 2.0 | 5 votes |
public Single<List<Media>> videoList(final String code, final int count) { final String subject = "movie:" + code; final String mediafmt = "mp4"; return Single .create(new SingleOnSubscribe<Pair<String, String>>() { @Override public void subscribe(SingleEmitter<Pair<String, String>> e) throws Exception { final String params = ServiceSecurity.construireParams(false, AllocineService.SUBJECT, subject, AllocineService.COUNT, "" + count, AllocineService.MEDIAFMT, mediafmt ); final String sed = ServiceSecurity.getSED(); final String sig = ServiceSecurity.getSIG(params, sed); e.onSuccess(Pair.create(sed, sig)); } }) .flatMap(new Function<Pair<String, String>, SingleSource<List<Media>>>() { @Override public SingleSource<List<Media>> apply(Pair<String, String> pair) throws Exception { return allocineService.videoList(subject, count, mediafmt, pair.first, pair.second) .map(new Function<AllocineResponse, List<Media>>() { @Override public List<Media> apply(AllocineResponse allocineResponse) throws Exception { return allocineResponse.getFeed().getMedia(); } }); } }) .compose(this.<List<Media>>retry()); }
Example #26
Source File: AllocineApi.java From Android-Allocine-Api with Apache License 2.0 | 5 votes |
/** * Filmographie d'une personne */ public Single<List<Participation>> filmography(final String idPerson, final String profile, final String filter) { return Single .create(new SingleOnSubscribe<Pair<String, String>>() { @Override public void subscribe(SingleEmitter<Pair<String, String>> e) throws Exception { final String params = ServiceSecurity.construireParams(false, AllocineService.CODE, idPerson, AllocineService.PROFILE, profile, AllocineService.FILTER, filter ); final String sed = ServiceSecurity.getSED(); final String sig = ServiceSecurity.getSIG(params, sed); e.onSuccess(Pair.create(sed, sig)); } }) .flatMap(new Function<Pair<String, String>, SingleSource<List<Participation>>>() { @Override public SingleSource<List<Participation>> apply(Pair<String, String> pair) throws Exception { return allocineService.filmography(idPerson, profile, filter, pair.first, pair.second) .map(new Function<AllocineResponse, List<Participation>>() { @Override public List<Participation> apply(AllocineResponse allocineResponse) throws Exception { return allocineResponse.getPerson().getParticipation(); } }); } }) .compose(this.<List<Participation>>retry()); }
Example #27
Source File: AllocineApi.java From Android-Allocine-Api with Apache License 2.0 | 5 votes |
public Single<List<Theater>> theaterList(final String zip, final int count, final int page) { return Single .create(new SingleOnSubscribe<Pair<String, String>>() { @Override public void subscribe(SingleEmitter<Pair<String, String>> e) throws Exception { final String params = ServiceSecurity.construireParams(false, AllocineService.ZIP, zip, AllocineService.COUNT, "" + count, AllocineService.PAGE, "" + page ); final String sed = ServiceSecurity.getSED(); final String sig = ServiceSecurity.getSIG(params, sed); e.onSuccess(Pair.create(sed, sig)); } }) .flatMap(new Function<Pair<String, String>, SingleSource<? extends List<Theater>>>() { @Override public SingleSource<? extends List<Theater>> apply(Pair<String, String> pair) throws Exception { return allocineService.theaterlist(zip, count, page, pair.first, pair.second) .map(new Function<AllocineResponse, List<Theater>>() { @Override public List<Theater> apply(AllocineResponse allocineResponse) throws Exception { return allocineResponse.getFeed().getTheater(); } }); } }) .compose(this.<List<Theater>>retry()); }
Example #28
Source File: AllocineApi.java From Android-Allocine-Api with Apache License 2.0 | 5 votes |
/** * Recherche */ public Single<AllocineResponseSmall> searchSmall(final String recherche, final List<String> filter, final int count, final int page) { return Single .create(new SingleOnSubscribe<Pair<String, String>>() { @Override public void subscribe(SingleEmitter<Pair<String, String>> e) throws Exception { final String params = ServiceSecurity.construireParams(false, AllocineService.Q, "" + recherche.replace(" ", "+"), AllocineService.FILTER, filter, AllocineService.COUNT, "" + count, AllocineService.PAGE, "" + page ); final String sed = ServiceSecurity.getSED(); final String sig = ServiceSecurity.getSIG(params, sed); e.onSuccess(Pair.create(sed, sig)); } }) .flatMap(new Function<Pair<String, String>, SingleSource<AllocineResponseSmall>>() { @Override public SingleSource<AllocineResponseSmall> apply(Pair<String, String> pair) throws Exception { return allocineService.searchSmall(recherche, ServiceSecurity.applatir(filter), count, page, pair.first, pair.second); } }) .compose(this.<AllocineResponseSmall>retry()); }
Example #29
Source File: AllocineApi.java From Android-Allocine-Api with Apache License 2.0 | 5 votes |
public Single<List<Movie>> movieList(List<MovieListFilter> filter, final Profile profile, final MovieListOrder order, final int count, final int page) { final List<String> filterString = new ArrayList<>(); for (MovieListFilter movieListFilter : filter) { filterString.add(movieListFilter.getValue()); } return Single .create(new SingleOnSubscribe<Pair<String, String>>() { @Override public void subscribe(SingleEmitter<Pair<String, String>> e) throws Exception { final String params = ServiceSecurity.construireParams(true, AllocineService.FILTER, filterString, AllocineService.PROFILE, profile.getValue(), AllocineService.ORDER, order.getValue(), AllocineService.COUNT, "" + count, AllocineService.PAGE, "" + page ); final String sed = ServiceSecurity.getSED(); final String sig = ServiceSecurity.getSIG(params, sed); e.onSuccess(Pair.create(sed, sig)); } }) .flatMap(new Function<Pair<String, String>, SingleSource<? extends List<Movie>>>() { @Override public SingleSource<? extends List<Movie>> apply(Pair<String, String> pair) throws Exception { return allocineService.movieList(ServiceSecurity.applatir(filterString), profile.getValue(), order.getValue(), count, page, pair.first, pair.second) .map(new Function<AllocineResponse, List<Movie>>() { @Override public List<Movie> apply(AllocineResponse allocineResponse) throws Exception { return allocineResponse.getFeed().getMovie(); } }); } }) .compose(this.<List<Movie>>retry()); }
Example #30
Source File: AllocineApi.java From Android-Allocine-Api with Apache License 2.0 | 5 votes |
public Single<List<PersonFull>> starsList(final List<PersonListFilter> filter, final Profile profile, final int count, final int page) { final List<String> filterString = new ArrayList<>(); for (PersonListFilter movieListFilter : filter) { filterString.add(movieListFilter.getValue()); } return Single .create(new SingleOnSubscribe<Pair<String, String>>() { @Override public void subscribe(SingleEmitter<Pair<String, String>> e) throws Exception { final String params = ServiceSecurity.construireParams(true, AllocineService.FILTER, filterString, AllocineService.PROFILE, profile.getValue(), AllocineService.COUNT, "" + count, AllocineService.PAGE, "" + page ); final String sed = ServiceSecurity.getSED(); final String sig = ServiceSecurity.getSIG(params, sed); e.onSuccess(Pair.create(sed, sig)); } }) .flatMap(new Function<Pair<String, String>, SingleSource<? extends List<PersonFull>>>() { @Override public SingleSource<? extends List<PersonFull>> apply(Pair<String, String> pair) throws Exception { return allocineService.personList(ServiceSecurity.applatir(filterString), profile.getValue(), count, page, pair.first, pair.second) .map(new Function<AllocineResponse, List<PersonFull>>() { @Override public List<PersonFull> apply(AllocineResponse allocineResponse) throws Exception { return allocineResponse.getFeed().getPerson(); } }); } }) .compose(this.<List<PersonFull>>retry()); }