@Override public void onSuccess(final ImageContainer container) { LogUtils.d(TAG, "onSuccess"); progressView.post( new Runnable() { @Override public void run() { progressView.setVisibility(View.GONE); Bitmap bitmap = container.getBitmap(); int oldWidth = bitmap.getWidth(); int oldHeight = bitmap.getHeight(); float f = ((float) imageWidth) / oldWidth; int dheight = (int) (f * oldHeight); Bitmap bm = null; try { bm = Bitmap.createScaledBitmap(bitmap, imageWidth, dheight, false); } catch (OutOfMemoryError e) { e.printStackTrace(); System.gc(); MainApplication.getImageLoader().getImageCache().trim(); try { Thread.sleep(10); } catch (InterruptedException e1) { e1.printStackTrace(); } bm = Bitmap.createScaledBitmap(bitmap, imageWidth, dheight, false); } iconIv.setImageBitmap(bm); } }); }
@Override public void onError(ImageContainer container) { LogUtils.d(TAG, "onError"); progressView.post( new Runnable() { @Override public void run() { progressView.setVisibility(View.GONE); } }); }
@Override public void onProgress(final ImageContainer container) { LogUtils.d(TAG, "onProgress"); progressView.post( new Runnable() { @Override public void run() { progressView.setMax((int) container.getMax()); progressView.setProgress((int) container.getProgress()); } }); }
@Override public void onWait(ImageContainer container) { LogUtils.d(TAG, "onWait"); progressView.post( new Runnable() { @Override public void run() { progressView.setWaiting(true); progressView.setVisibility(View.VISIBLE); } }); }
@Override public void onStarted(final ImageContainer container) { LogUtils.d(TAG, "onStarted"); progressView.post( new Runnable() { @Override public void run() { progressView.setVisibility(View.VISIBLE); progressView.setMax((int) container.getMax()); progressView.setProgress((int) container.getProgress()); } }); }
@Override public void onStart(ImageContainer container) { LogUtils.d(TAG, "onStart"); progressView.setVisibility(View.VISIBLE); progressView.setWaiting(false); }