Search in sources :

Example 26 with ImageRequest

use of com.facebook.imagepipeline.request.ImageRequest in project ride-read-android by Ride-Read.

the class PersonalityMapActivity method addMoment2Map.

private void addMoment2Map(Moment moment) {
    LatLng latLng = new LatLng(moment.getLatitude(), moment.getLongitude());
    ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(moment.getPictures().get(0) + QiNiuUtils.CROP_SMALL_100)).setProgressiveRenderingEnabled(true).build();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, Utils.getAppContext());
    dataSource.subscribe(new BaseBitmapDataSubscriber() {

        @Override
        public void onNewResultImpl(@Nullable Bitmap bitmap) {
            addMarker(latLng, bitmap, moment);
        }

        @Override
        public void onFailureImpl(DataSource dataSource) {
        }
    }, CallerThreadExecutor.getInstance());
}
Also used : Bitmap(android.graphics.Bitmap) ImageRequest(com.facebook.imagepipeline.request.ImageRequest) CloseableReference(com.facebook.common.references.CloseableReference) LatLng(com.amap.api.maps.model.LatLng) ImagePipeline(com.facebook.imagepipeline.core.ImagePipeline) BaseBitmapDataSubscriber(com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber) DataSource(com.facebook.datasource.DataSource)

Example 27 with ImageRequest

use of com.facebook.imagepipeline.request.ImageRequest 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 28 with ImageRequest

use of com.facebook.imagepipeline.request.ImageRequest 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)

Example 29 with ImageRequest

use of com.facebook.imagepipeline.request.ImageRequest 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 30 with ImageRequest

use of com.facebook.imagepipeline.request.ImageRequest 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)

Aggregations

ImageRequest (com.facebook.imagepipeline.request.ImageRequest)71 DraweeController (com.facebook.drawee.interfaces.DraweeController)22 ResizeOptions (com.facebook.imagepipeline.common.ResizeOptions)19 CloseableReference (com.facebook.common.references.CloseableReference)17 Uri (android.net.Uri)13 Bitmap (android.graphics.Bitmap)11 ImagePipeline (com.facebook.imagepipeline.core.ImagePipeline)11 File (java.io.File)10 CacheKey (com.facebook.cache.common.CacheKey)9 DataSource (com.facebook.datasource.DataSource)8 BaseBitmapDataSubscriber (com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber)8 PipelineDraweeController (com.facebook.drawee.backends.pipeline.PipelineDraweeController)7 Animatable (android.graphics.drawable.Animatable)6 BaseControllerListener (com.facebook.drawee.controller.BaseControllerListener)6 CloseableImage (com.facebook.imagepipeline.image.CloseableImage)6 ImageInfo (com.facebook.imagepipeline.image.ImageInfo)6 EncodedImage (com.facebook.imagepipeline.image.EncodedImage)5 ImageRequestBuilder (com.facebook.imagepipeline.request.ImageRequestBuilder)5 Nullable (android.support.annotation.Nullable)4 FileBinaryResource (com.facebook.binaryresource.FileBinaryResource)4