本文整理汇总了Java中com.facebook.drawee.backends.pipeline.PipelineDraweeController类的典型用法代码示例。如果您正苦于以下问题:Java PipelineDraweeController类的具体用法?Java PipelineDraweeController怎么用?Java PipelineDraweeController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PipelineDraweeController类属于com.facebook.drawee.backends.pipeline包,在下文中一共展示了PipelineDraweeController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
public static void load(Uri uri,SimpleDraweeView draweeView,BasePostprocessor processor,int width,int height,
BaseControllerListener listener){
ImageRequest request =
ImageRequestBuilder.newBuilderWithSource(uri)
.setPostprocessor(processor)
.setResizeOptions(new ResizeOptions(width,height))
//缩放,在解码前修改内存中的图片大小, 配合Downsampling可以处理所有图片,否则只能处理jpg,
// 开启Downsampling:在初始化时设置.setDownsampleEnabled(true)
.setProgressiveRenderingEnabled(true)//支持图片渐进式加载
.setAutoRotateEnabled(true) //如果图片是侧着,可以自动旋转
.build();
PipelineDraweeController controller =
(PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setControllerListener(listener)
.setOldController(draweeView.getController())
.setAutoPlayAnimations(true) //自动播放gif动画
.build();
draweeView.setController(controller);
}
示例2: setFrescoImage
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
public void setFrescoImage(SimpleDraweeView frescoImage, String url , int w, int h){
if (isNull(url)){
// frescoImage.setImageURI(Uri.parse("" + R.drawable.fallload));
frescoImage.setImageResource(R.drawable.fallload);
return;
}
// int width = ScreenUtil.dip2px(w), height = ScreenUtil.dip2px(h);
if (!url.startsWith("http")){
url = "file://"+url;
}
// showErrorLog(url);
Uri uri = Uri.parse(url);
// frescoImage.setImageURI(uri);
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
.setResizeOptions(new ResizeOptions(w, h))
.build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setOldController(frescoImage.getController())
.setImageRequest(request)
.build();
frescoImage.setController(controller);
}
示例3: bindRaw
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
public void bindRaw(String fileName) {
if (bindedFile != null) {
bindedFile.detach();
bindedFile = null;
}
currentId = 0;
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(new File(fileName)))
.setAutoRotateEnabled(true)
.build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setOldController(getController())
.setImageRequest(request)
.build();
setController(controller);
}
示例4: bindRaw
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
public void bindRaw(String fileName) {
if (bindedFile != null) {
bindedFile.detach();
bindedFile = null;
}
currentId = 0;
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(new File(fileName)))
.setResizeOptions(new ResizeOptions(size, size))
.setAutoRotateEnabled(true)
.build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setOldController(getController())
.setImageRequest(request)
.build();
setController(controller);
}
示例5: onBindViewHolder
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Image image = images.get(position);
holder.image = image;
if (image == null) {
return;
}
holder.ivCheck.setVisibility(View.VISIBLE);
holder.ivCheck.setImageResource(selectedImages.contains(image) ? R.drawable.ap_gallery_checked
: R.drawable.ap_gallery_normal);
int width = 100, height = 100;
ImageRequest request =
ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(new File(image.path)))
.setResizeOptions(new ResizeOptions(width, height))
.build();
PipelineDraweeController controller =
(PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setOldController(holder.ivPhoto.getController())
.setImageRequest(request)
.build();
holder.ivPhoto.setController(controller);
}
示例6: onDownloaded
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
@Override
public void onDownloaded(FileSystemReference reference) {
if (isPhoto) {
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(new File(reference.getDescriptor())))
.setResizeOptions(new ResizeOptions(previewView.getLayoutParams().width,
previewView.getLayoutParams().height))
.build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setOldController(previewView.getController())
.setImageRequest(request)
.build();
previewView.setController(controller);
// previewView.setImageURI(Uri.fromFile(new File(reference.getDescriptor())));
} else {
checkFastThumb();
}
progressValue.setText(100 + "");
progressView.setValue(100);
goneView(progressContainer);
goneView(progressView);
goneView(progressValue);
}
示例7: displayImageResize
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
public static void displayImageResize(SimpleDraweeView view ,String url,int width,int height,float ratio){
Uri uri = Uri.parse(url);
view.setAspectRatio(ratio);
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
.setResizeOptions(new ResizeOptions(width, height))
.build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setOldController(view.getController())
.setImageRequest(request)
.build();
view.setHierarchy(getImageViewHierarchy(WEApplication.getContext().getResources(), false, 0));
view.setController(controller);
}
示例8: setSupportGif
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
public static void setSupportGif(SimpleDraweeView draweeView, String url){
PipelineDraweeController controller =
(PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setUri(url)
.setOldController(draweeView.getController())
.setAutoPlayAnimations(true) //自动播放gif动画
.build();
draweeView.setController(controller);
}
示例9: getController
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
/**
* 渐进式加载
*
* @param url
* @param draweeView
* @return
*/
public static PipelineDraweeController getController(String url, SimpleDraweeView draweeView) {
ImageRequest request = ImageRequestBuilder
.newBuilderWithSource(Uri.parse(url))
.setProgressiveRenderingEnabled(true)
.build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(draweeView.getController())
.build();
return controller;
}
示例10: convert
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
@Override
public void convert(final BaseViewHolder holder, final TngouModel.TngouBean tngouBean, final int position) {
super.convert(holder, tngouBean, position);
final SimpleDraweeView mImage = holder.getView(R.id.mImage);
final String url = RequestServiceTngou.ImageHear + tngouBean.img;
Uri uri = Uri.parse(url);
Postprocessor redMeshPostprocessor = new BasePostprocessor() {
@Override
public String getName() {
return url;
}
@Override
public void process(Bitmap bitmap) {
if (imageHeights.get(url + "height") == null) {
imageHeights.put(url + "height", UtilsDynamicSize.defaultDisplayWidth / 3 * bitmap.getHeight() / bitmap.getWidth());
imageHeights.put(url + "width", UtilsDynamicSize.defaultDisplayWidth / 3);
}
mImage.getLayoutParams().height = imageHeights.get(url + "height");
mImage.getLayoutParams().width = imageHeights.get(url + "width");
}
};
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
.setPostprocessor(redMeshPostprocessor)
.build();
PipelineDraweeController controller = (PipelineDraweeController)
Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(mImage.getController())
// other setters as you need
.build();
mImage.setController(controller);
}
示例11: convert
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
@Override
public void convert(final BaseViewHolder holder, final MzituModel bean, final int position) {
super.convert(holder, bean, position);
final SimpleDraweeView mImage = holder.getView(R.id.mImage);
final String url = bean.imagePath;
Uri uri = Uri.parse(url);
Postprocessor redMeshPostprocessor = new BasePostprocessor() {
@Override
public String getName() {
return url;
}
@Override
public void process(Bitmap bitmap) {
if (imageHeights.get(url + "height") == null) {
imageHeights.put(url + "height", UtilsDynamicSize.defaultDisplayWidth / 3 * bitmap.getHeight() / bitmap.getWidth());
imageHeights.put(url + "width", UtilsDynamicSize.defaultDisplayWidth / 3);
}
mImage.getLayoutParams().height = imageHeights.get(url + "height");
mImage.getLayoutParams().width = imageHeights.get(url + "width");
}
};
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
.setPostprocessor(redMeshPostprocessor)
.build();
PipelineDraweeController controller = (PipelineDraweeController)
Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(mImage.getController())
// other setters as you need
.build();
mImage.setController(controller);
}
示例12: setImageURI
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
@Override
public void setImageURI(Uri uri) {
ImageRequest request = ImageRequestBuilder
.newBuilderWithSource(uri)
.setLocalThumbnailPreviewsEnabled(true)
.setProgressiveRenderingEnabled(false)
.setResizeOptions(new ResizeOptions(50, 50))
.build();
/*
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(uri)
.setTapToRetryEnabled(true)
.setImageRequest(request)
.setOldController(getController())
.build();*/
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setUri(uri)
.setTapToRetryEnabled(true)
.setImageRequest(request)
.setOldController(getController())
.build();
setController(controller);
super.setImageURI(uri);
}
示例13: updateData
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
private void updateData() {
user = AccountLogic.getInstance().getNowUser();
if(user == null){
return;
}
tvName.setText(user.getName());
String url = ActivityUtil.genPic(user.getId().hashCode());
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url))
.setPostprocessor(postprocessor)
.build();
PipelineDraweeController controller =
(PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(ivBg.getController())
.build();
ivBg.setController(controller);
String avartar = "https://second.imdao.cn"+user.getAvatar();
Timber.i("avatar:"+avartar);
ivAvatar.setImageURI(Uri.parse(avartar));
StringBuilder desc = new StringBuilder();
desc.append(getString(R.string.readed)).append(" ")
.append(user.getReadCount())
.append(" ").append(getString(R.string.collected))
.append(" ").append(user.getCollectCount())
.append(" ").append(getString(R.string.share))
.append(" ").append(user.getShareCount());
tvSig.setText(desc);
registerAt.setText("加入时间:"+DateUtil.getFriendlyTimeSpanByNow(user.getCreateAt()));
}
示例14: onBindViewHolderToChild
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
@Override protected void onBindViewHolderToChild(MediaInfo model,ImageSelectViewHolder holder, int position) {
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(ImageFilePathUtil.getImgUrl(model.fileName)))
.setResizeOptions(new ResizeOptions(100, 100)).build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setOldController(holder.picImageView.getController())
.setImageRequest(request)
.build();
holder.picImageView.setController(controller);
holder.videoIcon.setVisibility(model.mediaType == 3 ? View.VISIBLE:View.GONE);
}
示例15: getView
import com.facebook.drawee.backends.pipeline.PipelineDraweeController; //导入依赖的package包/类
@Override public View getView(int position, View convertView, ViewGroup viewGroup) {
ViewHolder h;
AlbumInfo albumInfo = (AlbumInfo) getItem(position);
if(null == convertView){
convertView = LayoutInflater.from(context).inflate(R.layout.ablum_list_view_item, null);
h = new ViewHolder();
h.albumCover = (SimpleDraweeView) convertView.findViewById(R.id.album_cover);
h.albumName = (TextView) convertView.findViewById(R.id.album_name);
h.albumNumber = (TextView) convertView.findViewById(R.id.album_count);
h.chooseIcon = (ImageView) convertView.findViewById(R.id.icon_item_choosen);
convertView.setTag(h);
}else{
h = (ViewHolder) convertView.getTag();
}
MediaInfo imageInfo = albumInfo.medias.get(0);
String path = imageInfo.fileName;
if(!TextUtils.isEmpty(imageInfo.thumbPath)){
path = imageInfo.thumbPath;
}
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(ImageFilePathUtil.getImgUrl(path)))
.setResizeOptions(new ResizeOptions(100, 100)).build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setOldController(h.albumCover.getController())
.setImageRequest(request)
.build();
h.albumCover.setController(controller);
h.albumName.setText(albumInfo.name);
h.albumNumber.setText(""+albumInfo.medias.size());
if(hasChooseItemName.equals(albumInfo.name)) {
h.chooseIcon.setImageDrawable(DrawableUtil.decodeFromVector(context, R.drawable.ic_radio_button_checked));
h.chooseIcon.setVisibility(View.VISIBLE);
}else
h.chooseIcon.setVisibility(View.GONE);
return convertView;
}