public final class ApolloCallback<T>
extends <any>
Android wrapper for ApolloCall.Callback to be operated on specified Handler
onHttpError(ApolloHttpException) will be called on the background thread if provided handler is
attached to the main looper. This behaviour is intentional as ApolloHttpException internally has a reference
to raw okhttp3.Response that must be closed on the background, otherwise it throws NetworkOnMainThreadException exception.| Constructor and Description |
|---|
ApolloCallback(<any> callback,
android.os.Handler handler) |
| Modifier and Type | Method and Description |
|---|---|
void |
onFailure(ApolloException e) |
void |
onHttpError(ApolloHttpException e) |
void |
onNetworkError(ApolloNetworkException e) |
void |
onParseError(ApolloParseException e) |
void |
onResponse(<any> response) |
void |
onStatusEvent(ApolloCall.StatusEvent event) |
static <T> ApolloCallback<T> |
wrap(<any> callback,
android.os.Handler handler)
Wraps
callback to be be operated on specified handler |
public ApolloCallback(<any> callback,
android.os.Handler handler)
callback - original callback to delegates callshandler - the callback will be run on the thread to which this handler is attachedpublic static <T> ApolloCallback<T> wrap(<any> callback, android.os.Handler handler)
callback to be be operated on specified handlercallback - original callback to delegates callshandler - the callback will be run on the thread to which this handler is attachedpublic void onResponse(<any> response)
public void onStatusEvent(ApolloCall.StatusEvent event)
public void onFailure(ApolloException e)
public void onHttpError(ApolloHttpException e)
public void onNetworkError(ApolloNetworkException e)
public void onParseError(ApolloParseException e)