Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void loadPostPhotoAsync(final String url, ImageSize imageSize, final ImageLoadCallback imageLoadCallback) {
- Log.d(TAG, "try to load image with url = " + url);
- if (imageSize.getWidth() == 0 || imageSize.getHeight() == 0) {
- imageSize = new ImageSize(100, 100);
- }
- final NonViewAware imageAware = new NonViewAware(imageSize, ViewScaleType.CROP) {
- @Override
- public boolean setImageBitmap(Bitmap bitmap) {
- imageLoadCallback.onLoad(url, bitmap);
- return super.setImageBitmap(bitmap);
- }
- };
- ImageDataLoader.getInstance().getImageLoader().displayImage(url, imageAware);
- }
- public void loadPostPhotoAsync(String url, final ImageLoadCallback imageLoadCallback) {
- Log.d(TAG, "try to load image with url = " + url);
- ImageDataLoader.getInstance().getImageLoader().loadImage(url, ImageDataLoader.getInstance().getDisplayImageOptions(), new ImageLoadingListener() {
- @Override
- public void onLoadingStarted(String s, View view) {
- }
- @Override
- public void onLoadingFailed(final String s, View view, FailReason failReason) {
- Log.i(TAG, "onLoadingFailed with url = " + s);
- new Handler(Looper.getMainLooper()).post(new Runnable() {
- @Override
- public void run() {
- imageLoadCallback.onLoadError(s);
- }
- });
- }
- @Override
- public void onLoadingComplete(final String s, View view, final Bitmap bitmap) {
- Log.i(TAG, "onLoadingComplete with url = " + s + " bitmap is null = " + String.valueOf(bitmap == null));
- new Handler(Looper.getMainLooper()).post(new Runnable() {
- @Override
- public void run() {
- imageLoadCallback.onLoad(s, bitmap);
- }
- });
- }
- @Override
- public void onLoadingCancelled(String s, View view) {
- Log.i(TAG, "onLoadingCancelled with url = " + s);
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement