use of com.facebook.samples.scrollperf.instrumentation.InstrumentedDraweeView 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.samples.scrollperf.instrumentation.InstrumentedDraweeView 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