Search in sources :

Example 6 with GenericDraweeHierarchy

use of com.facebook.drawee.generic.GenericDraweeHierarchy in project fresco by facebook.

the class FrescoAdapter method onCreateViewHolder.

@Override
public FrescoHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(getContext().getResources()).setPlaceholderImage(Drawables.sPlaceholderDrawable).setFailureImage(Drawables.sErrorDrawable).setProgressBarImage(new ProgressBarDrawable()).setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER).build();
    final InstrumentedDraweeView instrView = new InstrumentedDraweeView(getContext(), gdh);
    return new FrescoHolder(getContext(), parent, instrView, getPerfListener());
}
Also used : ProgressBarDrawable(com.facebook.drawee.drawable.ProgressBarDrawable) FrescoHolder(com.facebook.samples.comparison.holders.FrescoHolder) GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) GenericDraweeHierarchyBuilder(com.facebook.drawee.generic.GenericDraweeHierarchyBuilder) InstrumentedDraweeView(com.facebook.samples.comparison.instrumentation.InstrumentedDraweeView)

Example 7 with GenericDraweeHierarchy

use of com.facebook.drawee.generic.GenericDraweeHierarchy in project fresco by facebook.

the class VolleyDraweeAdapter method onCreateViewHolder.

@Override
public VolleyDraweeHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(getContext().getResources()).setPlaceholderImage(Drawables.sPlaceholderDrawable).setFailureImage(Drawables.sErrorDrawable).build();
    InstrumentedDraweeView view = new InstrumentedDraweeView(getContext());
    view.setHierarchy(gdh);
    return new VolleyDraweeHolder(getContext(), parent, view, getPerfListener());
}
Also used : GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) GenericDraweeHierarchyBuilder(com.facebook.drawee.generic.GenericDraweeHierarchyBuilder) VolleyDraweeHolder(com.facebook.samples.comparison.holders.VolleyDraweeHolder) InstrumentedDraweeView(com.facebook.samples.comparison.instrumentation.InstrumentedDraweeView)

Example 8 with GenericDraweeHierarchy

use of com.facebook.drawee.generic.GenericDraweeHierarchy in project fresco by facebook.

the class DraweeViewAdapter method onCreateViewHolder.

@Override
public DraweeViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    GenericDraweeHierarchy gdh = DraweeUtil.createDraweeHierarchy(mContext, mConfig);
    final InstrumentedDraweeView simpleDraweeView = new InstrumentedDraweeView(mContext, gdh, mConfig);
    simpleDraweeView.setPadding(mPaddingPx, mPaddingPx, mPaddingPx, mPaddingPx);
    return new DraweeViewHolder(parent, simpleDraweeView, mConfig, mPerfListener);
}
Also used : GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) InstrumentedDraweeView(com.facebook.samples.scrollperf.instrumentation.InstrumentedDraweeView)

Example 9 with GenericDraweeHierarchy

use of com.facebook.drawee.generic.GenericDraweeHierarchy in project Rocket.Chat.Android by RocketChat.

the class RocketChatAvatar method loadImage.

public void loadImage(Drawable drawable) {
    final GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
    // Is there a better way?
    hierarchy.setImage(drawable, 100, true);
}
Also used : GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy)

Example 10 with GenericDraweeHierarchy

use of com.facebook.drawee.generic.GenericDraweeHierarchy 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)

Aggregations

GenericDraweeHierarchy (com.facebook.drawee.generic.GenericDraweeHierarchy)20 GenericDraweeHierarchyBuilder (com.facebook.drawee.generic.GenericDraweeHierarchyBuilder)11 RoundingParams (com.facebook.drawee.generic.RoundingParams)5 ProgressBarDrawable (com.facebook.drawee.drawable.ProgressBarDrawable)4 DraweeController (com.facebook.drawee.interfaces.DraweeController)4 Uri (android.net.Uri)3 ResizeOptions (com.facebook.imagepipeline.common.ResizeOptions)3 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)3 Canvas (android.graphics.Canvas)2 PointF (android.graphics.PointF)2 Drawable (android.graphics.drawable.Drawable)2 InstrumentedDraweeView (com.facebook.samples.comparison.instrumentation.InstrumentedDraweeView)2 InstrumentedDraweeView (com.facebook.samples.scrollperf.instrumentation.InstrumentedDraweeView)2 Context (android.content.Context)1 Resources (android.content.res.Resources)1 Animatable (android.graphics.drawable.Animatable)1 Nullable (android.support.annotation.Nullable)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1