Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.koushikdutta.ion;
 
 import  android.graphics.Bitmap;
 import  android.graphics.BitmapFactory;
 import  android.graphics.Point;
 import  android.text.TextUtils;
 
    int resizeWidth;
    int resizeHeight;
    public LoadBitmap(Ion ionString urlKeyboolean putint resizeWidthint resizeHeightboolean animateGifIonRequestBuilder.EmitterTransform<ByteBufferListemitterTransform) {
        super(ionurlKeyputanimateGifemitterTransform);
        this. = resizeWidth;
        this. = resizeHeight;
        this. = animateGif;
        this. = emitterTransform;
    }
    @Override
    public void onCompleted(Exception efinal ByteBufferList result) {
        if (e != null) {
            report(enull);
            return;
        }
        if (..tag() != this) {
            result.recycle();
            return;
        }
        Ion.getBitmapLoadExecutorService().execute(new Runnable() {
            @Override
            public void run() {
                if (..tag() != LoadBitmap.this) {
                    result.recycle();
                    return;
                }
                ByteBuffer bb = null;
                try {
                    bb = result.getAll();
                    Bitmap bitmap;
                    GifDecoder gifDecoder;
                    BitmapFactory.Options options = ..prepareBitmapOptions(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining(), );
                    final Point size = new Point(options.outWidthoptions.outHeight);
                    if ( && TextUtils.equals("image/gif"options.outMimeType)) {
//                        new GifDecoder(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining());
                        bitmap = null;
                        gifDecoder = new GifDecoder(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining());
                        gifDecoder.nextFrame();
                        bb = null;
                    }
                    else {
                        bitmap = IonBitmapCache.loadBitmap(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining(), options);
                        gifDecoder = null;
                        if (bitmap == null)
                            throw new Exception("failed to load bitmap");
                    }
                    BitmapInfo info = new BitmapInfo(options.outMimeTypebitmapsize);
                    info.gifDecoder = gifDecoder;
                    if ( != null)
                        info.loadedFrom = .loadedFrom();
                    else
                        info.loadedFrom = ..;
                    report(nullinfo);
                }
                catch (OutOfMemoryError e) {
                    report(new Exception(e), null);
                }
                catch (Exception e) {
                    report(enull);
                }
                finally {
                    ByteBufferList.reclaim(bb);
                }
            }
        });
    }
New to GrepCode? Check out our FAQ X