Java 类com.facebook.drawee.view.GenericDraweeView 实例源码

项目:S1-Go    文件:ImageLoader.java   
public void displayImageWithResizing(Uri imageUri, int width, int height, ImageView imageView) {
    if (!(imageView instanceof GenericDraweeView)) {
        throw new IllegalAccessError("please use fresco image view");
    }
    if (imageUri == null) {
        return;
    }
    ImageRequest req = ImageRequestBuilder.newBuilderWithSource(imageUri)
            .setResizeOptions(new ResizeOptions(width, height))
            .setLocalThumbnailPreviewsEnabled(true)
            .setProgressiveRenderingEnabled(true)
            .build();

    GenericDraweeView v = (GenericDraweeView) imageView;

    DraweeController ctrl = Fresco.newDraweeControllerBuilder()
            .setOldController(v.getController())
            .setImageRequest(req)
            .build();

    v.setController(ctrl);
}
项目:S1-Go    文件:ImageLoader.java   
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));
}
项目:S1-Go    文件:ImageLoader.java   
public void displayImage(Uri imageUri, ImageView imageView) {
    if (!(imageView instanceof GenericDraweeView)) {
        throw new IllegalAccessError("please use fresco image view");
    }
    if (imageUri == null) {
        return;
    }
    imageView.setImageURI(imageUri);
}
项目:S1-Go    文件:ImageLoader.java   
public void displayImageWithGif(String url, ImageView view) {
    if (view != null && view instanceof GenericDraweeView && !TextUtils.isEmpty(url)) {
        GenericDraweeView draweeView = (GenericDraweeView) view;
        ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url)).build();
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setImageRequest(request)
                .setOldController(draweeView.getController())
                .setAutoPlayAnimations(true)
                .build();
        draweeView.setController(controller);
    }
}