Search in sources :

Example 6 with ImageRequestBuilder

use of com.facebook.imagepipeline.request.ImageRequestBuilder in project boxing by Bilibili.

the class BoxingFrescoLoader method displayRaw.

@Override
public void displayRaw(@NonNull ImageView img, @NonNull String absPath, IBoxingCallback callback) {
    absPath = "file://" + absPath;
    ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(absPath));
    ImageRequest request = requestBuilder.build();
    loadImage(request, img, callback);
}
Also used : ImageRequest(com.facebook.imagepipeline.request.ImageRequest) ImageRequestBuilder(com.facebook.imagepipeline.request.ImageRequestBuilder)

Example 7 with ImageRequestBuilder

use of com.facebook.imagepipeline.request.ImageRequestBuilder in project fresco by facebook.

the class DraweeViewHolder method bind.

/**
 * @param uri The Uri to show into the DraweeView for this Holder
 */
public void bind(Uri uri) {
    mDraweeView.initInstrumentation(uri.toString(), mPerfListener);
    ImageRequestBuilder imageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(uri).setResizeOptions(new ResizeOptions(mDraweeView.getLayoutParams().width, mDraweeView.getLayoutParams().height));
    PipelineUtil.addOptionalFeatures(imageRequestBuilder, mConfig);
    // Create the Builder
    PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder().setImageRequest(imageRequestBuilder.build());
    if (mConfig.reuseOldController) {
        builder.setOldController(mDraweeView.getController());
    }
    mDraweeView.setListener(builder);
    mDraweeView.setController(builder.build());
}
Also used : ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) ImageRequestBuilder(com.facebook.imagepipeline.request.ImageRequestBuilder) PipelineDraweeControllerBuilder(com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder)

Example 8 with ImageRequestBuilder

use of com.facebook.imagepipeline.request.ImageRequestBuilder in project fresco by facebook.

the class DraweeViewListAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    InstrumentedDraweeView draweeView;
    if (convertView == null) {
        final Context context = parent.getContext();
        GenericDraweeHierarchy gdh = DraweeUtil.createDraweeHierarchy(context, mConfig);
        draweeView = new InstrumentedDraweeView(context, gdh, mConfig);
        SizeUtil.setConfiguredSize(parent, draweeView, mConfig);
        draweeView.setPadding(mPaddingPx, mPaddingPx, mPaddingPx, mPaddingPx);
    } else {
        draweeView = (InstrumentedDraweeView) convertView;
    }
    final Uri uri = getItem(position);
    draweeView.initInstrumentation(uri.toString(), mPerfListener);
    ImageRequestBuilder imageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(uri).setResizeOptions(new ResizeOptions(draweeView.getLayoutParams().width, draweeView.getLayoutParams().height));
    PipelineUtil.addOptionalFeatures(imageRequestBuilder, mConfig);
    // Create the Builder
    PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder().setImageRequest(imageRequestBuilder.build());
    if (mConfig.reuseOldController) {
        builder.setOldController(draweeView.getController());
    }
    if (mConfig.instrumentationEnabled) {
        draweeView.setListener(builder);
    }
    draweeView.setController(builder.build());
    return draweeView;
}
Also used : Context(android.content.Context) GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) InstrumentedDraweeView(com.facebook.samples.scrollperf.instrumentation.InstrumentedDraweeView) Uri(android.net.Uri) ImageRequestBuilder(com.facebook.imagepipeline.request.ImageRequestBuilder) PipelineDraweeControllerBuilder(com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder)

Example 9 with ImageRequestBuilder

use of com.facebook.imagepipeline.request.ImageRequestBuilder in project fresco by facebook.

the class ImagePipelineUtilsImpl method createEncodedImageRequestBuilder.

@Nullable
protected ImageRequestBuilder createEncodedImageRequestBuilder(@Nullable Uri uri, EncodedImageOptions imageOptions) {
    if (uri == null) {
        return null;
    }
    ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
    maybeSetRequestPriority(builder, imageOptions.getPriority());
    return builder;
}
Also used : ImageRequestBuilder(com.facebook.imagepipeline.request.ImageRequestBuilder) Nullable(javax.annotation.Nullable)

Example 10 with ImageRequestBuilder

use of com.facebook.imagepipeline.request.ImageRequestBuilder in project fresco by facebook.

the class ImagePipelineUtilsImpl method createEncodedImageRequestBuilder.

@Nullable
protected ImageRequestBuilder createEncodedImageRequestBuilder(ImageRequest imageRequest, EncodedImageOptions imageOptions) {
    if (imageRequest == null) {
        return null;
    }
    ImageRequestBuilder builder = ImageRequestBuilder.fromRequest(imageRequest);
    maybeSetRequestPriority(builder, imageOptions.getPriority());
    return builder;
}
Also used : ImageRequestBuilder(com.facebook.imagepipeline.request.ImageRequestBuilder) Nullable(javax.annotation.Nullable)

Aggregations

ImageRequestBuilder (com.facebook.imagepipeline.request.ImageRequestBuilder)12 ResizeOptions (com.facebook.imagepipeline.common.ResizeOptions)6 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)5 Uri (android.net.Uri)4 CloseableReference (com.facebook.common.references.CloseableReference)3 PipelineDraweeControllerBuilder (com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder)3 Nullable (javax.annotation.Nullable)3 DataSource (com.facebook.datasource.DataSource)2 ImagePipeline (com.facebook.imagepipeline.core.ImagePipeline)2 Context (android.content.Context)1 Bitmap (android.graphics.Bitmap)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 Drawable (android.graphics.drawable.Drawable)1 DiskCacheConfig (com.facebook.cache.disk.DiskCacheConfig)1 PooledByteBuffer (com.facebook.common.memory.PooledByteBuffer)1 PooledByteBufferInputStream (com.facebook.common.memory.PooledByteBufferInputStream)1 OrientedDrawable (com.facebook.drawee.drawable.OrientedDrawable)1 GenericDraweeHierarchy (com.facebook.drawee.generic.GenericDraweeHierarchy)1 DraweeController (com.facebook.drawee.interfaces.DraweeController)1 AnimatedDrawable (com.facebook.imagepipeline.animated.base.AnimatedDrawable)1