com.lzy.okgo.callback.Callback Java Examples
The following examples show how to use
com.lzy.okgo.callback.Callback.
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: RequestFailedCachePolicy.java From BaseProject with Apache License 2.0 | 6 votes |
@Override public void requestAsync(CacheEntity<T> cacheEntity, Callback<T> callback) { mCallback = callback; runOnUiThread(new Runnable() { @Override public void run() { callbackOnStart(request); // mCallback.onStart(request); try { prepareRawCall(); } catch (Throwable throwable) { Response<T> error = Response.error(false, rawCall, null, throwable); callbackOnError(error); // mCallback.onError(error); return; } requestNetworkAsync(); } }); }
Example #2
Source File: NoCachePolicy.java From BaseProject with Apache License 2.0 | 6 votes |
@Override public void requestAsync(CacheEntity<T> cacheEntity, Callback<T> callback) { mCallback = callback; runOnUiThread(new Runnable() { @Override public void run() { callbackOnStart(request); // if (mCallback != null) { // mCallback.onStart(request); // } try { prepareRawCall(); } catch (Throwable throwable) { Response<T> error = Response.error(false, rawCall, null, throwable); callbackOnError(error); // mCallback.onError(error); return; } requestNetworkAsync(); } }); }
Example #3
Source File: DefaultCachePolicy.java From okhttp-OkGo with Apache License 2.0 | 6 votes |
@Override public void requestAsync(CacheEntity<T> cacheEntity, Callback<T> callback) { mCallback = callback; runOnUiThread(new Runnable() { @Override public void run() { mCallback.onStart(request); try { prepareRawCall(); } catch (Throwable throwable) { Response<T> error = Response.error(false, rawCall, null, throwable); mCallback.onError(error); return; } requestNetworkAsync(); } }); }
Example #4
Source File: FirstCacheRequestPolicy.java From okhttp-OkGo with Apache License 2.0 | 6 votes |
@Override public void requestAsync(final CacheEntity<T> cacheEntity, Callback<T> callback) { mCallback = callback; runOnUiThread(new Runnable() { @Override public void run() { mCallback.onStart(request); try { prepareRawCall(); } catch (Throwable throwable) { Response<T> error = Response.error(false, rawCall, null, throwable); mCallback.onError(error); return; } if (cacheEntity != null) { Response<T> success = Response.success(true, cacheEntity.getData(), rawCall, null); mCallback.onCacheSuccess(success); } requestNetworkAsync(); } }); }
Example #5
Source File: NoneCacheRequestPolicy.java From okhttp-OkGo with Apache License 2.0 | 6 votes |
@Override public void requestAsync(final CacheEntity<T> cacheEntity, Callback<T> callback) { mCallback = callback; runOnUiThread(new Runnable() { @Override public void run() { mCallback.onStart(request); try { prepareRawCall(); } catch (Throwable throwable) { Response<T> error = Response.error(false, rawCall, null, throwable); mCallback.onError(error); return; } if (cacheEntity != null) { Response<T> success = Response.success(true, cacheEntity.getData(), rawCall, null); mCallback.onCacheSuccess(success); mCallback.onFinish(); return; } requestNetworkAsync(); } }); }
Example #6
Source File: NoCachePolicy.java From okhttp-OkGo with Apache License 2.0 | 6 votes |
@Override public void requestAsync(CacheEntity<T> cacheEntity, Callback<T> callback) { mCallback = callback; runOnUiThread(new Runnable() { @Override public void run() { mCallback.onStart(request); try { prepareRawCall(); } catch (Throwable throwable) { Response<T> error = Response.error(false, rawCall, null, throwable); mCallback.onError(error); return; } requestNetworkAsync(); } }); }
Example #7
Source File: RequestFailedCachePolicy.java From okhttp-OkGo with Apache License 2.0 | 6 votes |
@Override public void requestAsync(CacheEntity<T> cacheEntity, Callback<T> callback) { mCallback = callback; runOnUiThread(new Runnable() { @Override public void run() { mCallback.onStart(request); try { prepareRawCall(); } catch (Throwable throwable) { Response<T> error = Response.error(false, rawCall, null, throwable); mCallback.onError(error); return; } requestNetworkAsync(); } }); }
Example #8
Source File: FirstCacheRequestPolicy.java From BaseProject with Apache License 2.0 | 6 votes |
@Override public void requestAsync(final CacheEntity<T> cacheEntity, Callback<T> callback) { mCallback = callback; runOnUiThread(new Runnable() { @Override public void run() { callbackOnStart(request); // mCallback.onStart(request); try { prepareRawCall(); } catch (Throwable throwable) { Response<T> error = Response.error(false, rawCall, null, throwable); callbackOnError(error); // mCallback.onError(error); return; } if (cacheEntity != null) { Response<T> success = Response.success(true, cacheEntity.getData(), rawCall, null); callbackOnCacheSuccess(success); // mCallback.onCacheSuccess(success); } requestNetworkAsync(); } }); }
Example #9
Source File: DefaultCachePolicy.java From BaseProject with Apache License 2.0 | 6 votes |
@Override public void requestAsync(CacheEntity<T> cacheEntity, Callback<T> callback) { mCallback = callback; runOnUiThread(new Runnable() { @Override public void run() { callbackOnStart(request); // mCallback.onStart(request); try { prepareRawCall(); } catch (Throwable throwable) { Response<T> error = Response.error(false, rawCall, null, throwable); callbackOnError(error); // mCallback.onError(error); return; } requestNetworkAsync(); } }); }
Example #10
Source File: Request.java From okhttp-OkGo with Apache License 2.0 | 5 votes |
/** 非阻塞方法,异步请求,但是回调在子线程中执行 */ public void execute(Callback<T> callback) { HttpUtils.checkNotNull(callback, "callback == null"); this.callback = callback; Call<T> call = adapt(); call.execute(callback); }
Example #11
Source File: CacheCall.java From okhttp-OkGo with Apache License 2.0 | 5 votes |
@Override public void execute(Callback<T> callback) { HttpUtils.checkNotNull(callback, "callback == null"); CacheEntity<T> cacheEntity = policy.prepareCache(); policy.requestAsync(cacheEntity, callback); }
Example #12
Source File: NoneCacheRequestPolicy.java From BaseProject with Apache License 2.0 | 5 votes |
@Override public void requestAsync(final CacheEntity<T> cacheEntity, Callback<T> callback) { mCallback = callback; runOnUiThread(new Runnable() { @Override public void run() { callbackOnStart(request); // mCallback.onStart(request); try { prepareRawCall(); } catch (Throwable throwable) { Response<T> error = Response.error(false, rawCall, null, throwable); callbackOnError(error); // mCallback.onError(error); return; } if (cacheEntity != null) { Response<T> success = Response.success(true, cacheEntity.getData(), rawCall, null); callbackOnCacheSuccess(success); callbackOnFinish(); // mCallback.onCacheSuccess(success); // mCallback.onFinish(); return; } requestNetworkAsync(); } }); }
Example #13
Source File: Request.java From BaseProject with Apache License 2.0 | 5 votes |
/** 非阻塞方法,异步请求,但是回调在子线程中执行 */ public void execute(Callback<T> callback) { // HttpUtils.checkNotNull(callback, "callback == null");//removed by fee : 允许callback为null this.callback = callback; Call<T> call = adapt(); call.execute(callback); }
Example #14
Source File: CacheCall.java From BaseProject with Apache License 2.0 | 5 votes |
@Override public void execute(Callback<T> callback) { // HttpUtils.checkNotNull(callback, "callback == null");//removed by fee: 允许callback为null CacheEntity<T> cacheEntity = policy.prepareCache(); policy.requestAsync(cacheEntity, callback); }
Example #15
Source File: Request.java From okhttp-OkGo with Apache License 2.0 | 4 votes |
public void setCallback(Callback<T> callback) { this.callback = callback; }
Example #16
Source File: Call.java From BaseProject with Apache License 2.0 | 4 votes |
/** 异步回调执行 */ void execute(Callback<T> callback);
Example #17
Source File: FileConvert.java From BaseProject with Apache License 2.0 | 4 votes |
public void setCallback(Callback<File> callback) { this.callback = callback; }
Example #18
Source File: Request.java From BaseProject with Apache License 2.0 | 4 votes |
public void setCallback(Callback<T> callback) { this.callback = callback; }
Example #19
Source File: ProgressRequestBody.java From BaseProject with Apache License 2.0 | 4 votes |
ProgressRequestBody(RequestBody requestBody, Callback<T> callback) { this.requestBody = requestBody; this.callback = callback; }
Example #20
Source File: Call.java From okhttp-OkGo with Apache License 2.0 | 4 votes |
/** 异步回调执行 */ void execute(Callback<T> callback);
Example #21
Source File: FileConvert.java From okhttp-OkGo with Apache License 2.0 | 4 votes |
public void setCallback(Callback<File> callback) { this.callback = callback; }
Example #22
Source File: ProgressRequestBody.java From okhttp-OkGo with Apache License 2.0 | 4 votes |
ProgressRequestBody(RequestBody requestBody, Callback<T> callback) { this.requestBody = requestBody; this.callback = callback; }
Example #23
Source File: CachePolicy.java From okhttp-OkGo with Apache License 2.0 | 2 votes |
/** * 异步请求获取数据 * * @param cacheEntity 本地的缓存 * @param callback 异步回调 */ void requestAsync(CacheEntity<T> cacheEntity, Callback<T> callback);
Example #24
Source File: CachePolicy.java From BaseProject with Apache License 2.0 | 2 votes |
/** * 异步请求获取数据 * * @param cacheEntity 本地的缓存 * @param callback 异步回调 */ void requestAsync(CacheEntity<T> cacheEntity, Callback<T> callback);