本文整理汇总了Java中com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder类的典型用法代码示例。如果您正苦于以下问题:Java PipelineDraweeControllerBuilder类的具体用法?Java PipelineDraweeControllerBuilder怎么用?Java PipelineDraweeControllerBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PipelineDraweeControllerBuilder类属于com.facebook.drawee.backends.pipeline包,在下文中一共展示了PipelineDraweeControllerBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bind
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
/**
* @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());
}
示例2: loadImage
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
public static void loadImage(final PhotoDraweeView mPhotoDraweeView,
Uri uri) {
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setUri(uri);
controller.setAutoPlayAnimations(true);
controller.setOldController(mPhotoDraweeView.getController());
controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
if (imageInfo == null || mPhotoDraweeView == null) {
return;
}
mPhotoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
}
});
mPhotoDraweeView.setController(controller.build());
}
示例3: loadImage
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
public void loadImage(String url,String lowurl, int placeHolderResId, int errorResId,ScalingUtils.ScaleType scaleType){
final boolean isHttp = url.startsWith("http");
Uri uri = isHttp ? Uri.parse(url) : Uri.fromFile(new File(url));
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder()
.setImageRequest(ImageRequest.fromUri(uri));
if(lowurl!=null && lowurl.startsWith("http")) {
controller .setLowResImageRequest(ImageRequest.fromUri(lowurl));
}
getHierarchy().setActualImageScaleType(scaleType);
// controller.setUri(URI);
getHierarchy().setPlaceholderImage(getResources().getDrawable( placeHolderResId ),scaleType);
getHierarchy().setFailureImage(getResources().getDrawable(errorResId),scaleType);
controller.setOldController(this.getController())
.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
if (imageInfo == null) {
return;
}
PhotoDraweeView.this.update(imageInfo.getWidth(), imageInfo.getHeight());
}
});
this.setController(controller.build());
}
示例4: getImageViewController
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
/**
* 图像选项类
* @param uri 图片路径
* @param oldController DraweeView.getoldcontroller
* @param controllerListener 监听
* @return
*/
public static DraweeController getImageViewController(String uri, DraweeController oldController,
ControllerListener<ImageInfo> controllerListener) {
PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder();
if (!TextUtils.isEmpty(uri)) {
// Logger.d("StringUtils.utf8Encode(uri)"+StringUtils.utf8Encode(uri));
builder.setUri(Uri.parse(uri));
}
if (oldController != null) {
builder.setOldController(oldController);
}
if (controllerListener != null) {
builder.setControllerListener(controllerListener);
}
return builder.build();
}
示例5: initLoad
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
@Override
public void initLoad() {
super.initLoad();
if (!TextUtils.isEmpty(mImageUrl)) {
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setUri(mImageUrl);
controller.setOldController(mPhotoIv.getController());
controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
if (imageInfo == null || mPhotoIv == null) {
return;
}
mPhotoIv.update(imageInfo.getWidth(), imageInfo.getHeight());
}
});
mPhotoIv.setController(controller.build());
}
}
示例6: display
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
public static void display(final PhotoDraweeView draweeView, Uri uri) {
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setUri(uri);
controller.setOldController(draweeView.getController());
controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
if (imageInfo == null || draweeView == null) {
return;
}
draweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
}
});
draweeView.setController(controller.build());
}
示例7: onCreate
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String imageUrl = getIntent().getStringExtra(IMAGE_URL);
if (!TextUtils.isEmpty(imageUrl)) {
PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder();
builder.setUri(Uri.parse(imageUrl));
builder.setOldController(photoView.getController());
builder.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
if (imageInfo == null || photoView == null) {
return;
}
photoView.update(imageInfo.getWidth(), imageInfo.getHeight());
}
});
photoView.setController(builder.build());
}
}
示例8: setImage
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
public static void setImage(ImageView view, String url, int width, int height) {
// Create URI.
Uri uri = Uri.parse(url);
// Create an image controller builder.
PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder();
// Provide some standard config.
builder = builder.setOldController(getDrawee(view).getController()).setUri(uri).setAutoPlayAnimations(true);
// Get image request.
ImageRequestBuilder request = getImageRequest(url, width, height);
// Generate the final controller with image request.
getDrawee(view).setController(builder.setImageRequest(request.build()).build());
}
示例9: displayImage
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
public void displayImage(String imageUri, ImageView imageView, ImageLoadingListener listener) {
if (TextUtils.isEmpty(imageUri)) return;
if (imageView instanceof GenericDraweeView) {
if (listener != null) {
PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder();
ImageLoaderListener listener1 = new ImageLoaderListener();
listener1.setData(listener, imageUri, imageView);
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imageUri)).build();
AbstractDraweeController controller = builder.setOldController(((GenericDraweeView) imageView).getController()).setControllerListener(listener1).setImageRequest(request).build();
((GenericDraweeView) imageView).setController(controller);
return;
}
}
imageView.setImageURI(Uri.parse(imageUri));
}
示例10: getView
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
@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;
}
示例11: setImageUriAndAutoPlay
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
public void setImageUriAndAutoPlay(String uri){
PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder()
.setAutoPlayAnimations(true);
if(!TextUtils.isEmpty(uri)){
builder.setUri(Uri.parse(uri));
}
setController(builder.build());
}
示例12: init
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
@Override
protected void init() {
super.init();
transparentStatusBar();
ButterKnife.bind(this);
url = getIntent().getStringExtra("url");
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setUri(Uri.parse(url));
controller.setAutoPlayAnimations(true);
controller.setOldController(photoDraweeView.getController());
controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
if (imageInfo == null || photoDraweeView == null) {
return;
}
photoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
normalScale = photoDraweeView.getScale();
}
});
photoDraweeView.setController(controller.build());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
String name = getIntent().getStringExtra("transition_name");
photoDraweeView.setTransitionName(name);
getWindow().setSharedElementEnterTransition(DraweeTransition.createTransitionSet(
ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.FIT_CENTER));
getWindow().setSharedElementReturnTransition(DraweeTransition.createTransitionSet(
ScalingUtils.ScaleType.FIT_CENTER, ScalingUtils.ScaleType.CENTER_CROP));
}
}
示例13: setImageURI
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
@Override
public void setImageURI(Uri uri, Object callerContext) {
DraweeController controller = ((PipelineDraweeControllerBuilder)getControllerBuilder())
.setControllerListener(listener)
.setCallerContext(callerContext)
.setUri(uri)
.setOldController(getController())
.build();
setController(controller);
}
示例14: loadImage
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
/***
* load net work image.
* @param url the main url of image, from net
* @param lowUrl the low url, from net or local image file name, can be null.
* @param placeHolder the place holder. 0 with no place holder
* @param errorResId error res id , 0 with no error res.
* @param width the width you want
* @param height the height you want
* @param scaleType scale type
* @param l BaseControllerListener,can be null
*/
public void loadImage(String url, String lowUrl,int placeHolder, int errorResId,
ScalingUtils.ScaleType scaleType, int width , int height ,
final BaseControllerListener<ImageInfo> l){
ImageRequest request = ImageRequestBuilder
.newBuilderWithSource(Uri.parse(url))
//.setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH)
.setResizeOptions(new ResizeOptions(width, height))
.build();
getHierarchy().setActualImageScaleType(scaleType);
if(placeHolder!=0) {
getHierarchy().setPlaceholderImage(getResources().getDrawable( placeHolder ),scaleType);
}
if(errorResId!=0){
getHierarchy().setFailureImage(getResources().getDrawable( errorResId ),scaleType);
}
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder()
.setControllerListener(l)
.setImageRequest(request)
.setOldController(getController());
if(lowUrl!=null){
Uri lowUri = lowUrl.startsWith("http") ? Uri.parse(lowUrl) : Uri.fromFile(new File(lowUrl));
controller.setLowResImageRequest(ImageRequestBuilder.newBuilderWithSource(lowUri)
.setResizeOptions(new ResizeOptions(width, height))
.build() );
}
setController(controller.build());
}
示例15: loadImageURI
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入依赖的package包/类
private void loadImageURI(Uri uri, @Nullable Object callerContext, int width, int height) {
// 对URL做格式转换、尺寸限制等处理
uri = Uri.parse(ImageUtils.format(uri.toString(), DisplayInfo.getWidthPixels()));
ImageRequestBuilder imageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(uri);
imageRequestBuilder.setProgressiveRenderingEnabled(true);
imageRequestBuilder.setRotationOptions(RotationOptions.autoRotateAtRenderTime());
if (width > 0 && height > 0) {
imageRequestBuilder.setResizeOptions(new ResizeOptions(width, height));
}
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder()
.setCallerContext(callerContext)
.setImageRequest(imageRequestBuilder.build())
.setOldController(getController())
.setAutoPlayAnimations(true) // 自动播放动态图
.setTapToRetryEnabled(true) // 在加载失败时,可以点击重新加载
.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id,
ImageInfo imageInfo,
Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
onUpdateImage(imageInfo);
}
});
if (AppUtils.isMainThread()) {
setController(controller.build());
} else {
Observable.just(0)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(it -> setController(controller.build()));
}
}