当前位置: 首页>>代码示例>>Java>>正文


Java ImagePipeline.fetchDecodedImage方法代码示例

本文整理汇总了Java中com.facebook.imagepipeline.core.ImagePipeline.fetchDecodedImage方法的典型用法代码示例。如果您正苦于以下问题:Java ImagePipeline.fetchDecodedImage方法的具体用法?Java ImagePipeline.fetchDecodedImage怎么用?Java ImagePipeline.fetchDecodedImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.imagepipeline.core.ImagePipeline的用法示例。


在下文中一共展示了ImagePipeline.fetchDecodedImage方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attach

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
void attach(BitmapUpdateListener listener) {
  mBitmapUpdateListener = listener;

  mAttachCounter++;
  if (mAttachCounter != 1) {
    // this is a secondary attach, ignore it, only updating Bitmap boundaries if needed.
    Bitmap bitmap = getBitmap();
    if (bitmap != null) {
      listener.onSecondaryAttach(bitmap);
    }
    return;
  }

  listener.onImageLoadEvent(ImageLoadEvent.ON_LOAD_START);

  Assertions.assertCondition(mDataSource == null);
  Assertions.assertCondition(mImageRef == null);

  // Submit the request
  ImagePipeline imagePipeline = ImagePipelineFactory.getInstance().getImagePipeline();
  mDataSource = imagePipeline.fetchDecodedImage(mImageRequest, RCTImageView.getCallerContext());
  mDataSource.subscribe(this, UiThreadImmediateExecutorService.getInstance());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:24,代码来源:PipelineRequestHelper.java

示例2: setImage

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
public void setImage(String uri) {
    if (uri == null) {
        iconBitmapDescriptor = null;
        update();
    } else if (uri.startsWith("http://") || uri.startsWith("https://") ||
            uri.startsWith("file://")) {
        ImageRequest imageRequest = ImageRequestBuilder
                .newBuilderWithSource(Uri.parse(uri))
                .build();

        ImagePipeline imagePipeline = Fresco.getImagePipeline();
        dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setImageRequest(imageRequest)
                .setControllerListener(mLogoControllerListener)
                .setOldController(logoHolder.getController())
                .build();
        logoHolder.setController(controller);
    } else {
        iconBitmapDescriptor = getBitmapDescriptorByName(uri);
        update();
    }
}
 
开发者ID:laoqiu,项目名称:react-native-amap,代码行数:24,代码来源:AMapMarker.java

示例3: loadBitmapFromUrl

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
public static void loadBitmapFromUrl(Context context, String url, String cookie, String referer, BaseBitmapDataSubscriber dataSubscriber) {
    if (TextUtils.isEmpty(url))
        return;
    Uri uri = Uri.parse(url);
    JsonObject header = new JsonObject();
    header.addProperty("Cookie", cookie);
    header.addProperty("Referer", referer);
    if (HProxy.isEnabled() && HProxy.isAllowPicture()) {
        HProxy proxy = new HProxy(url);
        header.addProperty(proxy.getHeaderKey(), proxy.getHeaderValue());
    }
    MyOkHttpNetworkFetcher.headers.put(uri, getGson().toJson(header));
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
    ImageRequest request = builder.build();
    DataSource<CloseableReference<CloseableImage>>
            dataSource = imagePipeline.fetchDecodedImage(request, context);
    dataSource.subscribe(dataSubscriber, CallerThreadExecutor.getInstance());
}
 
开发者ID:PureDark,项目名称:H-Viewer,代码行数:20,代码来源:ImageLoader.java

示例4: LoadImageFromURLAndCallBack

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
public static void LoadImageFromURLAndCallBack(SimpleDraweeView destImageView , String URL,Context context,BaseBitmapDataSubscriber bbds)
{
    int w = destImageView.getWidth();
    int h  =destImageView.getHeight();
    if(w<1){
        w = destImageView.getLayoutParams().width;
    }
    if(h<1){
        h  =destImageView.getLayoutParams().height;
    }
    ImageRequest imageRequest =
            ImageRequestBuilder.newBuilderWithSource(Uri.parse(URL))
                    .setResizeOptions(new ResizeOptions(w,h))
                    .setProgressiveRenderingEnabled(true)
                    .build();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, context);
    dataSource.subscribe(bbds, CallerThreadExecutor.getInstance());
    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setImageRequest(imageRequest)
            .setOldController(destImageView.getController())
            .setAutoPlayAnimations(true)
            .build();
    destImageView.setController(draweeController);
}
 
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:26,代码来源:FrescoImageloadHelper.java

示例5: LoadImageFromURIAndCallBack

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
public static void LoadImageFromURIAndCallBack(SimpleDraweeView destImageView , Uri uri,Context context,BaseBitmapDataSubscriber bbds)
{
    int w = destImageView.getWidth();
    int h  =destImageView.getHeight();
    if(w<1){
        w = destImageView.getLayoutParams().width;
    }
    if(h<1){
        h  =destImageView.getLayoutParams().height;
    }
    ImageRequest imageRequest =
            ImageRequestBuilder.newBuilderWithSource(uri)
                    .setResizeOptions(new ResizeOptions(w,h))
                    .setProgressiveRenderingEnabled(true)
                    .build();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, context);
    dataSource.subscribe(bbds, CallerThreadExecutor.getInstance());
    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setImageRequest(imageRequest)
            .setOldController(destImageView.getController())
            .setAutoPlayAnimations(true)
            .build();
    destImageView.setController(draweeController);
}
 
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:26,代码来源:FrescoImageloadHelper.java

示例6: displayImage

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
/**
 * 加载远程图片
 *
 * @param url
 * @param imageSize
 */
private void displayImage(Uri url, ResizeOptions imageSize, final ImageView imageView, final DraweeHolder<GenericDraweeHierarchy> draweeHolder) {
    ImageRequest imageRequest = ImageRequestBuilder
            .newBuilderWithSource(url)
            .setResizeOptions(imageSize)//图片目标大小
            .build();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();

    final DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setOldController(draweeHolder.getController())
            .setImageRequest(imageRequest)
            .setControllerListener(new BaseControllerListener<ImageInfo>() {
                @Override
                public void onFinalImageSet(String s, ImageInfo imageInfo, Animatable animatable) {
                    CloseableReference<CloseableImage> imageReference = null;
                    try {
                        imageReference = dataSource.getResult();
                        if (imageReference != null) {
                            CloseableImage image = imageReference.get();
                            if (image != null && image instanceof CloseableStaticBitmap) {
                                CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
                                Bitmap bitmap = closeableStaticBitmap.getUnderlyingBitmap();
                                if (bitmap != null && imageView != null) {
                                    imageView.setImageBitmap(bitmap);
                                }
                            }
                        }
                    } finally {
                        dataSource.close();
                        CloseableReference.closeSafely(imageReference);
                    }
                }
            })
            .setTapToRetryEnabled(true)
            .build();
    draweeHolder.setController(controller);
}
 
开发者ID:YuanPengandy,项目名称:GalleryFinal-master,代码行数:44,代码来源:FrescoImageLoader.java

示例7: setImageUri

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
public void setImageUri(String url) {
    ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url)).build();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    final DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setOldController(mDraweeHolder.getController())
            .setImageRequest(imageRequest)
            .setControllerListener(new BaseControllerListener<ImageInfo>() {
                @Override
                public void onFinalImageSet(String s, @Nullable ImageInfo imageInfo, @Nullable Animatable animatable) {
                    try {
                        imageReference = dataSource.getResult();
                        if (imageReference != null) {
                            CloseableImage image = imageReference.get();
                            // do something with the image
                            if (image != null && image instanceof CloseableStaticBitmap) {
                                CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
                                Bitmap bitmap = closeableStaticBitmap.getUnderlyingBitmap();
                                if (bitmap != null) {
                                    setImageBitmap(bitmap);
                                }
                            }
                        }
                    } finally {
                        dataSource.close();
                        CloseableReference.closeSafely(imageReference);
                    }
                }
            })
            .setTapToRetryEnabled(true)
            .build();
    mDraweeHolder.setController(controller);
}
 
开发者ID:lizubing1992,项目名称:Li-MVPArms,代码行数:34,代码来源:PhotoView.java

示例8: getBitmapWithFresco

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
public static void getBitmapWithFresco(Context context, String url, BaseBitmapDataSubscriber baseBitmapDataSubscriber) {
    ImageRequest imageRequest = ImageRequestBuilder
            .newBuilderWithSource(Uri.parse(url))
            .setProgressiveRenderingEnabled(true)
            .build();

    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>>
            dataSource = imagePipeline.fetchDecodedImage(imageRequest, context);
    dataSource.subscribe(baseBitmapDataSubscriber,
            CallerThreadExecutor.getInstance());
}
 
开发者ID:luania,项目名称:witchpot,代码行数:13,代码来源:MediaUtil.java

示例9: instantiateItem

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
@Override
public View instantiateItem(ViewGroup container, int position) {
    View view = LayoutInflater.from(ImageViewActivity.this).inflate(R.layout.item_imagepage, container, false);
    final PhotoView photoView = (PhotoView) view.findViewById(R.id.photoview);
    final View wheel = view.findViewById(R.id.wheel);
    photoView.setOnPhotoTapListener((view1, v, v1) -> finish());

    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(urls.get(position))
            .setResizeOptions(new ResizeOptions(768, 768))
            .build();
    DataSource<CloseableReference<CloseableImage>>
            dataSource = imagePipeline.fetchDecodedImage(request,this);
    DataSubscriber dataSubscriber = new BaseBitmapDataSubscriber() {
        @Override
        protected void onNewResultImpl(Bitmap bitmap) {
              photoView.setImageBitmap(bitmap);
              wheel.setVisibility(View.GONE);
        }

        @Override
        protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> closeableReferenceDataSource) {

        }
    };
    dataSource.subscribe(dataSubscriber, new Executor() {
        @Override
        public void execute(Runnable command) {
            handler.post(command);
        }
    });
    container.addView(view);
    return view;
}
 
开发者ID:Jude95,项目名称:Fishing,代码行数:35,代码来源:ImageViewActivity.java

示例10: get

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
public void get() {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imageUrl))
            .build();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>> dataSource
            = imagePipeline.fetchDecodedImage(request, WikipediaApp.getInstance());
    dataSource.subscribe(new BitmapDataSubscriber(), UiThreadImmediateExecutorService.getInstance());
}
 
开发者ID:wikimedia,项目名称:apps-android-wikipedia,代码行数:9,代码来源:ImagePipelineBitmapGetter.java

示例11: setSubscribe

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
private static final void setSubscribe(Context context, ImageRequest request, BaseDataSubscriber subscriber) {
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>> dataSource =
            imagePipeline.fetchDecodedImage(request, context);
    dataSource.subscribe(subscriber, CallerThreadExecutor.getInstance());
}
 
开发者ID:goodev,项目名称:materialup,代码行数:7,代码来源:FrescoUtils.java

示例12: setImageUri

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
public void setImageUri(String uri, ResizeOptions options) {

		final ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uri))
				.setResizeOptions(options)
				.setAutoRotateEnabled(true)
				.build();
		final ImagePipeline imagePipeline = Fresco.getImagePipeline();
		final DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
		final AbstractDraweeController controller = Fresco.newDraweeControllerBuilder()
				.setOldController(mDraweeHolder.getController())
				.setImageRequest(imageRequest)
				.setControllerListener(new BaseControllerListener<ImageInfo>() {
					@Override
					public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
						super.onFinalImageSet(id, imageInfo, animatable);

						CloseableReference<CloseableImage> imageCloseableReference = null;
						try {
							imageCloseableReference = dataSource.getResult();
							if (imageCloseableReference != null) {
								final CloseableImage image = imageCloseableReference.get();
								if (image != null && image instanceof CloseableStaticBitmap) {
									CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
									final Bitmap bitmap = closeableStaticBitmap.getUnderlyingBitmap();
									if (bitmap != null) {
										setImageBitmap(bitmap);
										// 如果是长图,让其宽度放大至与屏幕等宽
										setScaleType(ScaleType.CENTER_CROP);
									}
								}
							}
						} finally {
							dataSource.close();
							CloseableReference.closeSafely(imageCloseableReference);
						}
					}
				})
				.build();
		mDraweeHolder.setController(controller);
		setImageDrawable(mDraweeHolder.getTopLevelDrawable());
	}
 
开发者ID:iflove,项目名称:gank-examples,代码行数:42,代码来源:MyPhotoView.java

示例13: loadImageInternal

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
/**
 * Internal helper method for load Bitmap.
 *
 * @param maxSize 0 or less than 0 if want original bitmap.
 */
@Override
public void loadImageInternal(
        final Uri uri,
        final int maxSize,
        final ImageLoaderUtils.ImageLoadListener listener) {

    if (uri == null) {
        listener.onFailed(-1);
        return;
    }

    ImageRequestBuilder builder = ImageRequestBuilder
            .newBuilderWithSource(uri)
            .setAutoRotateEnabled(true);
    if (maxSize > 0) {
        builder.setResizeOptions(new ResizeOptions(maxSize, maxSize));
    }

    ImagePipeline pipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>> data =
            pipeline.fetchDecodedImage(builder.build(), null);

    Executor executor = new Executor() {
        @Override
        public void execute(@NonNull Runnable command) {
            ThreadManager.getInstance().postOnUIHandler(command);
        }
    };

    data.subscribe(new BaseBitmapDataSubscriber() {
        @Override
        protected void onNewResultImpl(Bitmap bitmap) {
            if (bitmap == null) {
                listener.onFailed(ImageLoaderUtils.ERROR_LOAD_EMPTY_IMAGE);
                return;
            }

            final int width = bitmap.getWidth();
            final int height = bitmap.getHeight();
            try {
                if (maxSize <= 0 || (width <= maxSize && height <= maxSize)) {
                    listener.onSuccess(uri, Bitmap.createBitmap(bitmap));
                } else {
                    JungleSize size = ImageUtils.getMaxScaleSize(
                            bitmap.getWidth(), bitmap.getHeight(), maxSize);
                    listener.onSuccess(uri, Bitmap.createScaledBitmap(
                            bitmap, size.getWidth(), size.getHeight(), true));
                }
            } catch (Throwable e) {
                e.printStackTrace();
                listener.onSuccess(uri, bitmap);
            }
        }

        @Override
        protected void onFailureImpl(
                DataSource<CloseableReference<CloseableImage>> dataSource) {
            listener.onFailed(ImageLoaderUtils.ERROR_LOAD_FAILED);
        }
    }, executor);
}
 
开发者ID:Android-Jungle,项目名称:android-jungle-framework,代码行数:67,代码来源:FrescoImageLoaderEngine.java

示例14: setImageUri

import com.facebook.imagepipeline.core.ImagePipeline; //导入方法依赖的package包/类
public void setImageUri(String uri) {

    final ImageRequest imageRequest =
        ImageRequestBuilder.newBuilderWithSource(Uri.parse(uri)).setResizeOptions(null).setAutoRotateEnabled(true).build();
    final ImagePipeline imagePipeline = Fresco.getImagePipeline();
    final DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
    final AbstractDraweeController controller = Fresco.newDraweeControllerBuilder()
        .setOldController(mDraweeHolder.getController())
        .setAutoPlayAnimations(true)
        .setImageRequest(imageRequest)
        .setControllerListener(new BaseControllerListener<ImageInfo>() {
          @Override public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
            super.onFinalImageSet(id, imageInfo, animatable);

            // set flag if this is an animated image
            if (animatable != null) {
              isAnimation = true;
            }

            CloseableReference<CloseableImage> imageCloseableReference = null;
            try {
              imageCloseableReference = dataSource.getResult();
              if (imageCloseableReference != null) {
                final CloseableImage image = imageCloseableReference.get();
                if (image != null && image instanceof CloseableStaticBitmap) {
                  CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
                  final Bitmap bitmap = closeableStaticBitmap.getUnderlyingBitmap();
                  if (bitmap != null) {
                    setImageBitmap(bitmap);
                  }
                }
              }
            } finally {
              dataSource.close();
              CloseableReference.closeSafely(imageCloseableReference);
            }
          }
        })
        .build();
    mDraweeHolder.setController(controller);
    setImageDrawable(mDraweeHolder.getTopLevelDrawable());
  }
 
开发者ID:zfdang,项目名称:zSMTH-Android,代码行数:43,代码来源:MyPhotoView.java


注:本文中的com.facebook.imagepipeline.core.ImagePipeline.fetchDecodedImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。