Java 类com.facebook.drawee.backends.pipeline.PipelineDraweeController 实例源码

项目:fastDev    文件:FrescoUtils.java   
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);
}
项目:videoPickPlayer    文件:VideoAdapter.java   
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);
    }
项目:actor-platform    文件:CallBackgroundAvatarView.java   
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);
}
项目:actor-platform    文件:AvatarView.java   
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);
}
项目:TLint    文件:ImageAdapter.java   
@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);
}
项目:africhat-platform-0.1    文件:PhotoHolder.java   
@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);
}
项目:africhat-platform-0.1    文件:AvatarView.java   
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);
}
项目:Li-MVPArms    文件:FrescoHelper.java   
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);
}
项目:MyImageUtil    文件:FrescoUtil.java   
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);
}
项目:SprintNBA    文件:FrescoUtils.java   
/**
 * 渐进式加载
 *
 * @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;
}
项目:WhiteRead    文件:TngouFragment.java   
@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);
}
项目:WhiteRead    文件:MzituFragment.java   
@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);
}
项目:Elephant    文件:MySimpleDraweeView.java   
@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);
    }
项目:fingerpoetry-android    文件:MineFragment.java   
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()));
}
项目:AndroidImageSelect    文件:MultiSelectImageActivity.java   
@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);
}
项目:AndroidImageSelect    文件:AlbumListAdapter.java   
@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;
}
项目:ImageSliderByFresco    文件:FrescoUtil.java   
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);
}
项目:ExoPlayerDemo    文件:FrescoImageUtil.java   
/**
 * 使用渐进式加载网络图片.
 * 只能用于网络图片加载
 *
 * @param simpleDraweeView 图片控件
 * @param url
 */
public static void displayImgWithProgressive(SimpleDraweeView simpleDraweeView, String url) {
    ImageRequest request = ImageRequestBuilder
            .newBuilderWithSource(FrescoImageUtil.getUriFromNet(url))
            .setProgressiveRenderingEnabled(true)
            .build();
    PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
            .setImageRequest(request)
            .setOldController(simpleDraweeView.getController())
            .build();
    simpleDraweeView.setController(controller);
}
项目:actor-platform    文件:PhotoHolder.java   
public void bindImage(Uri uri) {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
            .setResizeOptions(new ResizeOptions(previewView.getLayoutParams().width,
                    previewView.getLayoutParams().height))
            .build();
    PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
            .setOldController(previewView.getController())
            .setImageRequest(request)
            .setControllerListener(animationController)
            .build();
    previewView.setController(controller);
}
项目:actor-platform    文件:LocationHolder.java   
protected void onPostExecute(File result) {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(result))
            .setResizeOptions(new ResizeOptions(previewView.getLayoutParams().width,
                    previewView.getLayoutParams().height))
            .build();
    PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
            .setOldController(previewView.getController())
            .setImageRequest(request)
            .build();
    previewView.setController(controller);
}
项目:actor-platform    文件:FastAttachAdapter.java   
public void bind(String path) {
    data = path;
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(new File(path)))
            .setResizeOptions(new ResizeOptions(v.getLayoutParams().width,
                    v.getLayoutParams().height))
            .build();
    PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
            .setOldController(v.getController())
            .setImageRequest(request)
            .build();
    v.setController(controller);
    chb.setChecked(selected.contains(data));
}
项目:actor-platform    文件:StickerView.java   
public void bind(FileReference fileReference, int size) {

        if (this.fileReference != null && this.fileReference.equals(fileReference)) {
            return;
        }

        if (bindedFile != null) {
            bindedFile.detach();
            bindedFile = null;
        }

        setImageURI(null);

        this.fileReference = fileReference;

        bindedFile = messenger().bindFile(fileReference, true, new FileVMCallback() {

            private boolean isFastThumbLoaded = false;

            private void checkFastThumb() {
                if (!isFastThumbLoaded) {
                    isFastThumbLoaded = true;
//                    if (sticker.getThumb() != null) {
//                        fastThumbLoader.request(sticker.getThumb());
//                    }
                }
            }

            @Override
            public void onNotDownloaded() {
                checkFastThumb();
            }

            @Override
            public void onDownloading(float progress) {
                checkFastThumb();
            }

            @Override
            public void onDownloaded(FileSystemReference reference) {
                imageFile = new File(reference.getDescriptor());
                ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(imageFile))
                        .setAutoRotateEnabled(true)
                        .build();
                PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
                        .setOldController(getController())
                        .setImageRequest(request)
                        .build();
                setController(controller);
                loaded = true;


            }
        });
    }
项目:actor-platform    文件:CallBackgroundAvatarView.java   
public void bind(Avatar avatar) {
    // Same avatar
    if (avatar != null && getImage(avatar) != null
            && getImage(avatar).getFileReference().getFileId() == currentId) {
        return;
    }

    fastThumbLoader = new FastThumbLoader(this);
    fastThumbLoader.setBlur(10);

    if (bindedFile != null) {
        bindedFile.detach();
        bindedFile = null;
    }

    setImageURI(null);

    if (avatar == null || getImage(avatar) == null) {
        currentId = 0;
        return;
    }
    currentId = getImage(avatar).getFileReference().getFileId();

    bindedFile = messenger().bindFile(getImage(avatar).getFileReference(), true, new FileVMCallback() {
        @Override
        public void onNotDownloaded() {

        }

        @Override
        public void onDownloading(float progress) {

        }

        @Override
        public void onDownloaded(FileSystemReference reference) {

            blurActor.send(new BlurActor.RequestBlur(reference.getDescriptor(), 10, new BlurActor.BluredListener() {
                @Override
                public void onBlured(final File f) {
                    ((BaseActivity)getContext()).runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(f))
                                    .setResizeOptions(new ResizeOptions(Screen.getWidth(), Screen.getHeight()))
                                    .build();
                            PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
                                    .setOldController(getController())
                                    .setImageRequest(request)
                                    .build();
                            setController(controller);
                        }
                    });

                }
            }));
        }
    });
}
项目:actor-platform    文件:AvatarView.java   
public void bind(Avatar avatar, String title, int id) {
    // Same avatar
    if (avatar != null && getImage(avatar) != null
            && getImage(avatar).getFileReference().getFileId() == currentId) {
        return;
    }

    getHierarchy().setPlaceholderImage(new AvatarPlaceholderDrawable(title, id, placeholderTextSize, getContext()));

    if (bindedFile != null) {
        bindedFile.detach();
        bindedFile = null;
    }

    setImageURI(null);

    if (avatar == null || getImage(avatar) == null) {
        currentId = 0;
        return;
    }
    currentId = getImage(avatar).getFileReference().getFileId();

    bindedFile = messenger().bindFile(getImage(avatar).getFileReference(), true, new FileVMCallback() {
        @Override
        public void onNotDownloaded() {

        }

        @Override
        public void onDownloading(float progress) {

        }

        @Override
        public void onDownloaded(FileSystemReference reference) {


            ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(new File(reference.getDescriptor())))
                    .setResizeOptions(new ResizeOptions(size, size))
                    .build();
            PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
                    .setOldController(getController())
                    .setImageRequest(request)
                    .build();
            setController(controller);
        }
    });
}
项目:africhat-platform-0.1    文件:AvatarView.java   
public void bind(Avatar avatar, String title, int id) {
    // Same avatar
    if (avatar != null && avatar.getSmallImage() != null
            && avatar.getSmallImage().getFileReference().getFileId() == currentId) {
        return;
    }

    getHierarchy().setPlaceholderImage(new AvatarPlaceholderDrawable(title, id, placeholderTextSize, getContext()));

    if (bindedFile != null) {
        bindedFile.detach();
        bindedFile = null;
    }

    setImageURI(null);

    if (avatar == null || avatar.getSmallImage() == null) {
        currentId = 0;
        return;
    }
    currentId = avatar.getSmallImage().getFileReference().getFileId();

    bindedFile = messenger().bindFile(avatar.getSmallImage().getFileReference(), true, new FileVMCallback() {
        @Override
        public void onNotDownloaded() {

        }

        @Override
        public void onDownloading(float progress) {

        }

        @Override
        public void onDownloaded(FileSystemReference reference) {

            ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(new File(reference.getDescriptor())))
                    .setResizeOptions(new ResizeOptions(size, size))
                    .build();
            PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
                    .setOldController(getController())
                    .setImageRequest(request)
                    .build();
            setController(controller);
        }
    });
}