@Override protected void onPostExecute(Bitmap bitmap) { final T container = this.getTargetContainer(); if (container != null) { if (bitmap != null) { callBack.onLoadCompleted(container, this.uri, bitmap, displayConfig, from); } else { callBack.onLoadFailed(container, this.uri, displayConfig.getLoadFailedDrawable()); } } }
public <T extends View> void display( T container, String uri, BitmapDisplayConfig displayConfig, BitmapLoadCallBack<T> callBack) { if (container == null) { return; } container.clearAnimation(); if (callBack == null) { callBack = new SimpleBitmapLoadCallBack<T>(); } if (displayConfig == null || displayConfig == defaultDisplayConfig) { displayConfig = defaultDisplayConfig.cloneNew(); } // Optimize Max Size BitmapSize size = displayConfig.getBitmapMaxSize(); displayConfig.setBitmapMaxSize( BitmapCommonUtils.optimizeMaxSizeByView(container, size.getWidth(), size.getHeight())); callBack.onPreLoad(container, uri, displayConfig); if (TextUtils.isEmpty(uri)) { callBack.onLoadFailed(container, uri, displayConfig.getLoadFailedDrawable()); return; } Bitmap bitmap = globalConfig.getBitmapCache().getBitmapFromMemCache(uri, displayConfig); if (bitmap != null) { callBack.onLoadStarted(container, uri, displayConfig); callBack.onLoadCompleted(container, uri, bitmap, displayConfig, BitmapLoadFrom.MEMORY_CACHE); } else if (!bitmapLoadTaskExist(container, uri, callBack)) { final BitmapLoadTask<T> loadTask = new BitmapLoadTask<T>(container, uri, displayConfig, callBack); // set loading image final AsyncDrawable<T> asyncDrawable = new AsyncDrawable<T>(displayConfig.getLoadingDrawable(), loadTask); callBack.setDrawable(container, asyncDrawable); // load bitmap from uri or diskCache loadTask.executeOnExecutor(globalConfig.getBitmapLoadExecutor()); } }