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());
}
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());
}
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);
}
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);
}
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;
}
Aggregations