protected void onPostExecute(ImageContainer imageContainer) { if (imageContainer.getStatus() == ImageStatusCode.FILE_ENCODED) { listener.onSampleSuccess(imageContainer.getBitmap(), imageContainer.getByteImage()); } else { listener.onSampleError(imageContainer.getStatus()); } }
public ImageContainer set( String requestUrl, ImageView imageView, Drawable placeHolder, int maxWidth, int maxHeight, Bitmap bitmap) { // Find any old image load request pending on this ImageView (in case this view was // recycled) ImageContainer imageContainer = imageView.getTag() != null && imageView.getTag() instanceof ImageContainer ? (ImageContainer) imageView.getTag() : null; // Find image url from prior request // String recycledImageUrl = imageContainer != null ? imageContainer.getRequestUrl() : null; if (imageContainer != null) { // Cancel previous image request imageContainer.cancelRequest(); imageView.setTag(null); } if (requestUrl != null) { // Queue new request to fetch image imageContainer = set( requestUrl, getImageListener(getResources(), imageView, placeHolder, mFadeInImage), maxWidth, maxHeight, imageView.getScaleType(), bitmap); // Store request in ImageView tag imageView.setTag(imageContainer); } else { if (!(imageView instanceof PhotoView)) { imageView.setImageDrawable(placeHolder); } imageView.setTag(null); } return imageContainer; }