Search in sources :

Example 51 with DraweeController

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

the class FrescoUtils method loadImage.

/**
 * 请求图片
 * @param uri - 唯一的必选的成员. 参考 支持的URIs
 * @param width
 * @param height
 * autoRotateEnabled - 是否支持自动旋转.
 * progressiveEnabled - 是否支持渐进式加载.
 * postprocessor - 后处理器(postprocess).
 * resizeOptions - 图片缩放选项,用前请先阅读缩放和旋转
 */
public static void loadImage(SimpleDraweeView draweeView, String uri, int width, int height) {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uri)).setAutoRotateEnabled(// 是否支持自动旋转.
    true).setImageDecodeOptions(// 图片解码库
    getImageDecodeOptions()).setLowestPermittedRequestLevel(// 请求经过缓存级别  BITMAP_MEMORY_CACHE,ENCODED_MEMORY_CACHE,DISK_CACHE,FULL_FETCH
    RequestLevel.FULL_FETCH).setProgressiveRenderingEnabled(// 渐进加载,主要用于渐进式的JPEG图,影响图片显示速度(普通)
    false).setResizeOptions(new ResizeOptions(width, height)).build();
    DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(request).setOldController(draweeView.getController()).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 52 with DraweeController

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

the class FrescoUtils method moreImgRequst.

/**
 * 多图请求需 自定义ImageRequest(图片预览)
 * @param draweeView
 * @param lowResUri
 * @param highResUri
 */
public static void moreImgRequst(SimpleDraweeView draweeView, String lowResUri, String highResUri) {
    DraweeController controller = Fresco.newDraweeControllerBuilder().setLowResImageRequest(// 低分辨率的缩略图
    ImageRequest.fromUri(Uri.parse(lowResUri))).setImageRequest(// 高分辨率的图
    ImageRequest.fromUri(Uri.parse(highResUri))).setOldController(draweeView.getController()).build();
    draweeView.setController(controller);
}
Also used : DraweeController(com.facebook.drawee.interfaces.DraweeController)

Example 53 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project MyDiary by erttyy8821.

the class DiaryPhotoLayout method setPhotoUri.

public void setPhotoUri(Uri photoUri) {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(photoUri).setResizeOptions(new ResizeOptions(DiaryItemHelper.getVisibleWidth(getContext()), DiaryItemHelper.getVisibleHeight(getContext()))).setRotationOptions(RotationOptions.autoRotate()).build();
    DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(request).build();
    SDV_diary_new_photo.setController(controller);
}
Also used : ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) DraweeController(com.facebook.drawee.interfaces.DraweeController) ImageRequest(com.facebook.imagepipeline.request.ImageRequest)

Example 54 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project MyDiary by erttyy8821.

the class PhotoOverviewAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(final SimpleViewHolder holder, final int position) {
    final Uri photoUri = diaryPhotoFileList.get(position);
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(diaryPhotoFileList.get(position)).setResizeOptions(new ResizeOptions(resizePhotoWidth, resizePhotoHeight)).build();
    DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(request).setTapToRetryEnabled(false).build();
    holder.SDV_CV_diary_photo_overview.setController(controller);
}
Also used : ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) DraweeController(com.facebook.drawee.interfaces.DraweeController) ImageRequest(com.facebook.imagepipeline.request.ImageRequest) Uri(android.net.Uri)

Example 55 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project apps-android-commons by commons-app.

the class MediaDetailFragment method setupImageView.

/**
 * Uses two image sources.
 * - low resolution thumbnail is shown initially
 * - when the high resolution image is available, it replaces the low resolution image
 */
private void setupImageView() {
    image.getHierarchy().setPlaceholderImage(R.drawable.image_placeholder);
    image.getHierarchy().setFailureImage(R.drawable.image_placeholder);
    DraweeController controller = Fresco.newDraweeControllerBuilder().setLowResImageRequest(ImageRequest.fromUri(media != null ? media.getThumbUrl() : null)).setImageRequest(ImageRequest.fromUri(media != null ? media.getImageUrl() : null)).setControllerListener(aspectRatioListener).setOldController(image.getController()).build();
    image.setController(controller);
}
Also used : DraweeController(com.facebook.drawee.interfaces.DraweeController)

Aggregations

DraweeController (com.facebook.drawee.interfaces.DraweeController)56 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)6 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 ProgressBarDrawable (com.facebook.drawee.drawable.ProgressBarDrawable)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 GenericDraweeHierarchyBuilder (com.facebook.drawee.generic.GenericDraweeHierarchyBuilder)2