Skip to content

Instantly share code, notes, and snippets.

@ZherebtsovAlexandr
Last active May 9, 2017 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZherebtsovAlexandr/48d0bd682c7b1b7dab85551131befc76 to your computer and use it in GitHub Desktop.
Save ZherebtsovAlexandr/48d0bd682c7b1b7dab85551131befc76 to your computer and use it in GitHub Desktop.
public class SearchPlaceInteractorImpl extends SearchOffsetLimitIneractor {
private final PlaceDataProvider placeDataProvider;
public SearchPlaceInteractorImpl(ThreadExecutor threadExecutor,
PostExecutionThread postExecutionThread,
PlaceDataProvider placeDataProvider) {
super(threadExecutor, postExecutionThread);
this.placeDataProvider = placeDataProvider;
}
@Override
protected Observable buildUseCaseObservable() {
return Observable.zip(queryObservable, offsetObservable, (query, offset) ->
placeDataProvider.getPlacesRemote(query, offset, LIMIT)
.map(places -> toIds(places))
.flatMap(ids -> placeDataProvider.getPlacesByIdsLocal(ids)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment