本文整理汇总了Java中com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder.setOldController方法的典型用法代码示例。如果您正苦于以下问题:Java PipelineDraweeControllerBuilder.setOldController方法的具体用法?Java PipelineDraweeControllerBuilder.setOldController怎么用?Java PipelineDraweeControllerBuilder.setOldController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder
的用法示例。
在下文中一共展示了PipelineDraweeControllerBuilder.setOldController方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
示例4: 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());
}
}
示例5: 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());
}
示例6: 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());
}
}
示例7: 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;
}
示例8: 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));
}
}
示例9: 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;
}
示例10: getPreController
import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder; //导入方法依赖的package包/类
public static PipelineDraweeControllerBuilder getPreController(String url, final PhotoDraweeView draweeView) {
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url))
.setProgressiveRenderingEnabled(true)
.build();
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setImageRequest(request);
controller.setOldController(draweeView.getController());
controller.setAutoPlayAnimations(true);
return controller;
}
示例11: 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;
}
示例12: 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;
}
示例13: 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());
}