本文整理汇总了Java中com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder.setControllerListener方法的典型用法代码示例。如果您正苦于以下问题:Java PipelineDraweeControllerBuilder.setControllerListener方法的具体用法?Java PipelineDraweeControllerBuilder.setControllerListener怎么用?Java PipelineDraweeControllerBuilder.setControllerListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder
的用法示例。
在下文中一共展示了PipelineDraweeControllerBuilder.setControllerListener方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: 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();
}
示例3: 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());
}
}
示例4: 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());
}
示例5: 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());
}
}
示例6: 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));
}
}
示例7: getDraweeController
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入方法依赖的package包/类
/**
* 获取DraweeController
*
* @param imageRequest 设置单个图片请求~~~不可与setFirstAvailableImageRequests共用,配合setLowResImageRequest为高分辨率的图
* @param lowResImageRequest 先下载显示低分辨率的图
* @param firstAvailableImageRequests 本地图片复用,可加入ImageRequest数组
* @param controllerListener 监听图片下载完毕等
* @param tapToRetryEnabled 点击重新加载图
*/
public static PipelineDraweeControllerBuilder getDraweeController(SimpleDraweeView view, @Nullable ImageRequest imageRequest, ImageRequest lowResImageRequest, @Nullable ImageRequest[] firstAvailableImageRequests, @Nullable ControllerListener<ImageInfo> controllerListener, boolean tapToRetryEnabled) {
PipelineDraweeControllerBuilder builder = Fresco
.newDraweeControllerBuilder();
//自动播放图片动画
builder.setAutoPlayAnimations(true);
//点击重新加载图
builder.setTapToRetryEnabled(tapToRetryEnabled);
if (firstAvailableImageRequests != null &&
firstAvailableImageRequests.length > 0) {
//本地图片复用,可加入ImageRequest数组
builder.setFirstAvailableImageRequests(firstAvailableImageRequests);
} else if (imageRequest != null) {
//设置单个图片请求~~~不可与setFirstAvailableImageRequests共用,配合setLowResImageRequest为高分辨率的图
builder.setImageRequest(imageRequest);
if (lowResImageRequest != null) {
//先下载显示低分辨率的图
builder.setLowResImageRequest(lowResImageRequest);
}
}
if (controllerListener != null) {
//监听图片下载完毕等
builder.setControllerListener(controllerListener);
}
//DraweeController复用
builder.setOldController(view.getController());
return builder;
}
示例8: initImage
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入方法依赖的package包/类
private void initImage() {
PipelineDraweeControllerBuilder controller = FrescoUtils.getPreController(url, pdvImage);
controller.setControllerListener(listener);
final GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
.setProgressBarImage(new ImageLoadProgressBar(new ImageLoadProgressBar.OnLevelChangeListener() {
@Override
public void onChange(int level) {
if (level >= 100) {
hideLoadingDialog();
}
}
}, Color.parseColor("#90CCCCCC"))).build();
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER);
pdvImage.setHierarchy(hierarchy);
pdvImage.setController(controller.build());
pdvImage.setOnPhotoTapListener(new OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float x, float y) {
if (mActivity != null)
mActivity.finish();
}
});
pdvImage.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return true;
}
});
}
示例9: instantiateItem
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入方法依赖的package包/类
@Override public Object instantiateItem(ViewGroup viewGroup, int position) {
final PhotoDraweeView photoDraweeView = new PhotoDraweeView(viewGroup.getContext());
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setUri(Uri.parse("res:///" + mDrawables[position]));
if(position == 1){
String uri1 = "http://git.oschina.net/biezhihua/MyResource/raw/master/25-173250_974.gif ";
String uri2 = "http://img5.duitang.com/uploads/item/201511/04/20151104214718_FfnST.jpeg";
controller.setUri(Uri.parse(uri1));
}
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) {
return;
}
photoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
if(animatable != null){
animatable.start();
}
}
});
photoDraweeView.setController(controller.build());
try {
viewGroup.addView(photoDraweeView, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
} catch (Exception e) {
e.printStackTrace();
}
return photoDraweeView;
}
示例10: instantiateItem
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入方法依赖的package包/类
@Override public Object instantiateItem(ViewGroup viewGroup, int position) {
IImageInfo bean = images.get(position);
final PhotoDraweeView photoDraweeView = new PhotoDraweeView(viewGroup.getContext());
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setUri(Uri.parse(bean.getUri()));
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) {
return;
}
photoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
if(animatable != null){
animatable.start();
}
}
});
photoDraweeView.setController(controller.build());
try {
viewGroup.addView(photoDraweeView, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
} catch (Exception e) {
e.printStackTrace();
}
return photoDraweeView;
}
示例11: initData
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入方法依赖的package包/类
@Override
public void initData() {
showContent(true);
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url))
.setProgressiveRenderingEnabled(true)
.build();
GenericDraweeHierarchy hierarchy =
new GenericDraweeHierarchyBuilder(getResources()).setProgressBarImage(
new ImageLoadProgressBar(new ImageLoadProgressBar.OnLevelChangeListener() {
@Override
public void onChange(int level) {
if (level > 100 && progress.getVisibility() == View.VISIBLE) {
progress.setVisibility(View.GONE);
}
}
}, ResourceUtil.getThemeColor(getActivity()))).build();
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER);
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setControllerListener(listener);
controller.setImageRequest(request);
controller.setOldController(image.getController());
controller.setAutoPlayAnimations(true);
image.setHierarchy(hierarchy);
image.setController(controller.build());
}