Created
October 23, 2015 20:16
-
-
Save adipascu/0942364293ddd13ef5f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.addCallAdapterFactory(new CallAdapter.Factory() { | |
//relevant SO: https://github.com/square/retrofit/pull/1117 | |
RxJavaCallAdapterFactory delegate = RxJavaCallAdapterFactory.create(); | |
@Override | |
public CallAdapter<?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) { | |
//noinspection unchecked | |
CallAdapter<Observable<?>> delegate2 = (CallAdapter<Observable<?>>) delegate.get(returnType, annotations, retrofit); | |
return new CallAdapter<Object>() { | |
@Override | |
public Type responseType() { | |
return delegate2.responseType(); | |
} | |
@Override | |
public <R> Object adapt(Call<R> call) { | |
return delegate2.adapt(call).subscribeOn(Schedulers.io()); | |
} | |
}; | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment