@Override protected void onPostExecute(Boolean success) { AttachmentView attachmentView = downloadJob.getAttachmentView(); downloadJob.setSuccess(success); if (success) { attachmentView.setImage(bitmap, bitmapOrientation); } else { if (!downloadJob.hasRetry()) { attachmentView.signalImageLoadingError(); } } handler.sendEmptyMessage(0); }
private void loadImageThumbnail() { try { String filename = downloadJob.getFeedbackAttachment().getCacheId(); AttachmentView attachmentView = downloadJob.getAttachmentView(); bitmapOrientation = ImageUtils.determineOrientation(new File(dropFolder, filename)); int width = bitmapOrientation == ImageUtils.ORIENTATION_LANDSCAPE ? attachmentView.getWidthLandscape() : attachmentView.getWidthPortrait(); int height = bitmapOrientation == ImageUtils.ORIENTATION_LANDSCAPE ? attachmentView.getMaxHeightLandscape() : attachmentView.getMaxHeightPortrait(); bitmap = ImageUtils.decodeSampledBitmap(new File(dropFolder, filename), width, height); } catch (IOException e) { e.printStackTrace(); bitmap = null; } }