use of com.androidnetworking.common.ANRequest in project Fast-Android-Networking by amitshekhariitbhu.
the class ANImageLoader method makeImageRequest.
protected ANRequest makeImageRequest(String requestUrl, int maxWidth, int maxHeight, ImageView.ScaleType scaleType, final String cacheKey) {
ANRequest ANRequest = AndroidNetworking.get(requestUrl).setTag("ImageRequestTag").setBitmapMaxHeight(maxHeight).setBitmapMaxWidth(maxWidth).setImageScaleType(scaleType).setBitmapConfig(Bitmap.Config.RGB_565).setBitmapOptions(mBitmapOptions).build();
ANRequest.getAsBitmap(new BitmapRequestListener() {
@Override
public void onResponse(Bitmap response) {
onGetImageSuccess(cacheKey, response);
}
@Override
public void onError(ANError anError) {
onGetImageError(cacheKey, anError);
}
});
return ANRequest;
}
use of com.androidnetworking.common.ANRequest in project Fast-Android-Networking by amitshekhariitbhu.
the class ANRequestQueue method cancel.
private void cancel(RequestFilter filter, boolean forceCancel) {
synchronized (mCurrentRequests) {
try {
for (Iterator<ANRequest> iterator = mCurrentRequests.iterator(); iterator.hasNext(); ) {
ANRequest request = iterator.next();
if (filter.apply(request)) {
request.cancel(forceCancel);
if (request.isCanceled()) {
request.destroy();
iterator.remove();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
use of com.androidnetworking.common.ANRequest in project Fast-Android-Networking by amitshekhariitbhu.
the class ANRequestQueue method cancelAll.
public void cancelAll(boolean forceCancel) {
synchronized (mCurrentRequests) {
try {
for (Iterator<ANRequest> iterator = mCurrentRequests.iterator(); iterator.hasNext(); ) {
ANRequest request = iterator.next();
request.cancel(forceCancel);
if (request.isCanceled()) {
request.destroy();
iterator.remove();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Aggregations