Search in sources :

Example 16 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project fresco by facebook.

the class PartialRequestFragment method loadImageIntoDrawee.

private void loadImageIntoDrawee(SimpleDraweeView draweeView, @Nullable BytesRange bytesRange) {
    final ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(sampleUris().createSampleUri(ImageUriProvider.ImageSize.L)).setBytesRange(bytesRange).build();
    final DraweeController draweeController = Fresco.newDraweeControllerBuilder().setOldController(draweeView.getController()).setImageRequest(imageRequest).build();
    draweeView.setController(draweeController);
}
Also used : DraweeController(com.facebook.drawee.interfaces.DraweeController) ImageRequest(com.facebook.imagepipeline.request.ImageRequest)

Example 17 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project fresco by facebook.

the class FrescoHolder method onBind.

@Override
protected void onBind(String uriString) {
    Uri uri = Uri.parse(uriString);
    ImageRequestBuilder imageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(uri);
    if (UriUtil.isNetworkUri(uri)) {
        imageRequestBuilder.setProgressiveRenderingEnabled(true);
    } else {
        imageRequestBuilder.setResizeOptions(new ResizeOptions(mImageView.getLayoutParams().width, mImageView.getLayoutParams().height));
    }
    DraweeController draweeController = Fresco.newDraweeControllerBuilder().setImageRequest(imageRequestBuilder.build()).setOldController(mImageView.getController()).setControllerListener(mImageView.getListener()).setAutoPlayAnimations(true).build();
    mImageView.setController(draweeController);
}
Also used : ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) DraweeController(com.facebook.drawee.interfaces.DraweeController) Uri(android.net.Uri) ImageRequestBuilder(com.facebook.imagepipeline.request.ImageRequestBuilder)

Example 18 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project teaTime by ancfdy.

the class FrescoUtils method changeImgSize.

/**
 * 自定义图片尺寸
 * @param draweeView 显示的控件
 * @param uriString 地址
 * @param width 50
 * @param height 50
 */
public static void changeImgSize(SimpleDraweeView draweeView, String uriString, int width, int height) {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uriString)).setResizeOptions(new ResizeOptions(width, height)).build();
    DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(request).setAutoPlayAnimations(// other setters
    true).build();
    draweeView.setController(controller);
}
Also used : ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) DraweeController(com.facebook.drawee.interfaces.DraweeController) ImageRequest(com.facebook.imagepipeline.request.ImageRequest)

Example 19 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project teaTime by ancfdy.

the class FrescoUtils method loadGif.

/**
 * 加载gif图
 * @param draweeView
 * @param uriString
 */
public static void loadGif(SimpleDraweeView draweeView, String uriString) {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uriString)).build();
    DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(request).setAutoPlayAnimations(true).build();
    draweeView.setController(controller);
}
Also used : DraweeController(com.facebook.drawee.interfaces.DraweeController) ImageRequest(com.facebook.imagepipeline.request.ImageRequest)

Example 20 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project teaTime by ancfdy.

the class FrescoUtils method localImg.

/**
 * 缩略图预览(仅支持本地图片,并且是JPEG图片格式)
 * @param draweeView
 * @param uri
 */
public static void localImg(SimpleDraweeView draweeView, Uri uri) {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri).setLocalThumbnailPreviewsEnabled(true).build();
    DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(request).setOldController(draweeView.getController()).build();
    draweeView.setController(controller);
}
Also used : DraweeController(com.facebook.drawee.interfaces.DraweeController) ImageRequest(com.facebook.imagepipeline.request.ImageRequest)

Aggregations

DraweeController (com.facebook.drawee.interfaces.DraweeController)53 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)25 ResizeOptions (com.facebook.imagepipeline.common.ResizeOptions)10 Uri (android.net.Uri)8 SimpleDraweeView (com.facebook.drawee.view.SimpleDraweeView)8 Animatable (android.graphics.drawable.Animatable)7 BaseControllerListener (com.facebook.drawee.controller.BaseControllerListener)6 GenericDraweeHierarchy (com.facebook.drawee.generic.GenericDraweeHierarchy)5 ImageInfo (com.facebook.imagepipeline.image.ImageInfo)5 ControllerListener (com.facebook.drawee.controller.ControllerListener)4 QualityInfo (com.facebook.imagepipeline.image.QualityInfo)4 Drawable (android.graphics.drawable.Drawable)3 Nullable (android.support.annotation.Nullable)3 Canvas (android.graphics.Canvas)2 ColorDrawable (android.graphics.drawable.ColorDrawable)2 View (android.view.View)2 ViewGroup (android.view.ViewGroup)2 AbstractDraweeController (com.facebook.drawee.controller.AbstractDraweeController)2 ProgressBarDrawable (com.facebook.drawee.drawable.ProgressBarDrawable)2 GenericDraweeHierarchyBuilder (com.facebook.drawee.generic.GenericDraweeHierarchyBuilder)2