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


Java Postprocessor类代码示例

本文整理汇总了Java中com.facebook.imagepipeline.request.Postprocessor的典型用法代码示例。如果您正苦于以下问题:Java Postprocessor类的具体用法?Java Postprocessor怎么用?Java Postprocessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getPostprocessedBitmapCacheKey

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
@Override
public CacheKey getPostprocessedBitmapCacheKey(ImageRequest request, Object callerContext) {
  final Postprocessor postprocessor = request.getPostprocessor();
  final CacheKey postprocessorCacheKey;
  final String postprocessorName;
  if (postprocessor != null) {
    postprocessorCacheKey = postprocessor.getPostprocessorCacheKey();
    postprocessorName = postprocessor.getClass().getName();
  } else {
    postprocessorCacheKey = null;
    postprocessorName = null;
  }
  return new BitmapMemoryCacheKey(
      getCacheKeySourceUri(request.getSourceUri()).toString(),
      request.getResizeOptions(),
      request.getRotationOptions(),
      request.getImageDecodeOptions(),
      postprocessorCacheKey,
      postprocessorName,
      callerContext);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:DefaultCacheKeyFactory.java

示例2: produceResults

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
@Override
public void produceResults(
    final Consumer<CloseableReference<CloseableImage>> consumer,
    ProducerContext context) {
  final ProducerListener listener = context.getListener();
  final Postprocessor postprocessor = context.getImageRequest().getPostprocessor();
  final PostprocessorConsumer basePostprocessorConsumer =
      new PostprocessorConsumer(consumer, listener, context.getId(), postprocessor, context);
  final Consumer<CloseableReference<CloseableImage>> postprocessorConsumer;
  if (postprocessor instanceof RepeatedPostprocessor) {
    postprocessorConsumer = new RepeatedPostprocessorConsumer(
        basePostprocessorConsumer,
        (RepeatedPostprocessor) postprocessor,
        context);
  } else {
    postprocessorConsumer = new SingleUsePostprocessorConsumer(basePostprocessorConsumer);
  }
  mInputProducer.produceResults(postprocessorConsumer, context);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:PostprocessorProducer.java

示例3: PostprocessorConsumer

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
public PostprocessorConsumer(
    Consumer<CloseableReference<CloseableImage>> consumer,
    ProducerListener listener,
    String requestId,
    Postprocessor postprocessor,
    ProducerContext producerContext) {
  super(consumer);
  mListener = listener;
  mRequestId = requestId;
  mPostprocessor = postprocessor;
  producerContext.addCallbacks(
      new BaseProducerContextCallbacks() {
        @Override
        public void onCancellationRequested() {
          maybeNotifyOnCancellation();
        }
      });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:PostprocessorProducer.java

示例4: addOptionalFeatures

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
/**
 * Utility method which adds optional configuration to ImageRequest
 *
 * @param imageRequestBuilder The Builder for ImageRequest
 * @param config              The Config
 */
public static void addOptionalFeatures(ImageRequestBuilder imageRequestBuilder, Config config) {
  if (config.usePostprocessor) {
    final Postprocessor postprocessor;
    switch (config.postprocessorType) {
      case "use_slow_postprocessor":
        postprocessor = DelayPostprocessor.getMediumPostprocessor();
        break;
      case "use_fast_postprocessor":
        postprocessor = DelayPostprocessor.getFastPostprocessor();
        break;
      default:
        postprocessor = DelayPostprocessor.getMediumPostprocessor();
    }
    imageRequestBuilder.setPostprocessor(postprocessor);
  }
  if (config.rotateUsingMetaData) {
    imageRequestBuilder.setRotationOptions(RotationOptions.autoRotateAtRenderTime());
  } else {
    imageRequestBuilder
        .setRotationOptions(RotationOptions.forceRotation(config.forcedRotationAngle));
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:PipelineUtil.java

示例5: display

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
public void display(SimpleDraweeView view, String url, Postprocessor postprocessor) {
    if (!TextUtils.isEmpty(url)) {
        Uri uri;
        if (URLUtil.isNetworkUrl(url)) {
            uri = Uri.parse(url);
        } else {
            uri = Uri.fromFile(new File(url));
        }
        ImageRequest request = ImageRequestBuilder
                .newBuilderWithSource(uri)
                .setPostprocessor(postprocessor)
                .setProgressiveRenderingEnabled(true)
                //.setResizeOptions(new ResizeOptions(100, 100))
                .setLocalThumbnailPreviewsEnabled(true)
                .setRotationOptions(RotationOptions.autoRotateAtRenderTime())
                .build();

        controller = Fresco.newDraweeControllerBuilder()
                .setImageRequest(request)
                .setOldController(view.getController())
                .build();
        view.setController(controller);

    }

}
 
开发者ID:zhonglikui,项目名称:cardinalsSample,代码行数:27,代码来源:FrescoManager.java

示例6: getPostprocessedBitmapCacheKey

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
@Override
public CacheKey getPostprocessedBitmapCacheKey(ImageRequest request, Object callerContext) {
    final Postprocessor postprocessor = request.getPostprocessor();
    final CacheKey postprocessorCacheKey;
    final String postprocessorName;
    if (postprocessor != null) {
        postprocessorCacheKey = postprocessor.getPostprocessorCacheKey();
        postprocessorName = postprocessor.getClass().getName();
    } else {
        postprocessorCacheKey = null;
        postprocessorName = null;
    }
    return new BitmapMemoryCacheKey(
            getCacheKeySourceUri(request.getSourceUri()),
            request.getResizeOptions(),
            request.getRotationOptions(),
            request.getImageDecodeOptions(),
            postprocessorCacheKey,
            postprocessorName,
            callerContext);
}
 
开发者ID:senierr,项目名称:ModuleFrame,代码行数:22,代码来源:DefaultCacheKeyFactory.java

示例7: getPostprocessedBitmapCacheKey

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
@Override
public CacheKey getPostprocessedBitmapCacheKey(ImageRequest request, Object callerContext) {
    if (request instanceof LJImageRequest) {
        LJImageRequest ljImageRequest = (LJImageRequest) request;
        final Postprocessor postprocessor = request.getPostprocessor();
        final CacheKey postprocessorCacheKey;
        final String postprocessorName;
        if (postprocessor != null) {
            postprocessorCacheKey = postprocessor
                    .getPostprocessorCacheKey();
            postprocessorName = postprocessor.getClass().getName();
        } else {
            postprocessorCacheKey = null;
            postprocessorName = null;
        }
        return new BitmapMemoryCacheKey(getCacheKey(ljImageRequest), ljImageRequest
                .getResizeOptions(), ljImageRequest
                .getRotationOptions(), ljImageRequest
                .getImageDecodeOptions(), postprocessorCacheKey, postprocessorName, callerContext);
    }
    return super.getPostprocessedBitmapCacheKey(request, callerContext);
}
 
开发者ID:imliujun,项目名称:FrescoCustomCacheKey,代码行数:23,代码来源:LJCacheKeyFactory.java

示例8: getExtraMap

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
private Map<String, String> getExtraMap(
    ProducerListener listener,
    String requestId,
    Postprocessor postprocessor) {
  if (!listener.requiresExtraMap(requestId)) {
    return null;
  }
  return ImmutableMap.of(POSTPROCESSOR, postprocessor.getName());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:PostprocessorProducer.java

示例9: setPostprocessor

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
private void setPostprocessor(Postprocessor postprocessor) {
  final ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
      .setPostprocessor(postprocessor)
      .build();

  final DraweeController draweeController = Fresco.newDraweeControllerBuilder()
      .setOldController(mDraweeMain.getController())
      .setImageRequest(imageRequest)
      .build();

  mDraweeMain.setController(draweeController);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:ImagePipelinePostProcessorFragment.java

示例10: convert

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
@Override
public void convert(final BaseViewHolder holder, final TngouModel.TngouBean tngouBean, final int position) {
    super.convert(holder, tngouBean, position);

    final SimpleDraweeView mImage = holder.getView(R.id.mImage);
    final String url = RequestServiceTngou.ImageHear + tngouBean.img;

    Uri uri = Uri.parse(url);
    Postprocessor redMeshPostprocessor = new BasePostprocessor() {
        @Override
        public String getName() {
            return url;
        }

        @Override
        public void process(Bitmap bitmap) {
            if (imageHeights.get(url + "height") == null) {
                imageHeights.put(url + "height", UtilsDynamicSize.defaultDisplayWidth / 3 * bitmap.getHeight() / bitmap.getWidth());
                imageHeights.put(url + "width", UtilsDynamicSize.defaultDisplayWidth / 3);
            }

            mImage.getLayoutParams().height = imageHeights.get(url + "height");
            mImage.getLayoutParams().width = imageHeights.get(url + "width");
        }
    };

    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
            .setPostprocessor(redMeshPostprocessor)
            .build();

    PipelineDraweeController controller = (PipelineDraweeController)
            Fresco.newDraweeControllerBuilder()
                    .setImageRequest(request)
                    .setOldController(mImage.getController())
                    // other setters as you need
                    .build();
    mImage.setController(controller);
}
 
开发者ID:whitelaning,项目名称:WhiteRead,代码行数:39,代码来源:TngouFragment.java

示例11: convert

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
@Override
public void convert(final BaseViewHolder holder, final MzituModel bean, final int position) {
    super.convert(holder, bean, position);

    final SimpleDraweeView mImage = holder.getView(R.id.mImage);
    final String url = bean.imagePath;

    Uri uri = Uri.parse(url);
    Postprocessor redMeshPostprocessor = new BasePostprocessor() {
        @Override
        public String getName() {
            return url;
        }

        @Override
        public void process(Bitmap bitmap) {
            if (imageHeights.get(url + "height") == null) {
                imageHeights.put(url + "height", UtilsDynamicSize.defaultDisplayWidth / 3 * bitmap.getHeight() / bitmap.getWidth());
                imageHeights.put(url + "width", UtilsDynamicSize.defaultDisplayWidth / 3);
            }

            mImage.getLayoutParams().height = imageHeights.get(url + "height");
            mImage.getLayoutParams().width = imageHeights.get(url + "width");
        }
    };

    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
            .setPostprocessor(redMeshPostprocessor)
            .build();

    PipelineDraweeController controller = (PipelineDraweeController)
            Fresco.newDraweeControllerBuilder()
                    .setImageRequest(request)
                    .setOldController(mImage.getController())
                    // other setters as you need
                    .build();
    mImage.setController(controller);
}
 
开发者ID:whitelaning,项目名称:WhiteRead,代码行数:39,代码来源:MzituFragment.java

示例12: init

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
private static void init(FrescoImageView imageView, int cornerRadius, boolean isCircle, boolean isAnima,
                         Point size, Postprocessor postprocessor) {
    imageView.setAnim(isAnima);
    imageView.setCornerRadius(cornerRadius);
    imageView.setFadeTime(300);
    if (isCircle)
        imageView.asCircle();
    if (postprocessor != null)
        imageView.setPostProcessor(postprocessor);
    if (size != null) {
        imageView.setResize(size);
    }
}
 
开发者ID:CarGuo,项目名称:FrescoUtils,代码行数:14,代码来源:FrescoHelper.java

示例13: produceResults

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
@Override
public void produceResults(
    final Consumer<CloseableReference<CloseableImage>> consumer,
    final ProducerContext producerContext) {

  final ProducerListener listener = producerContext.getListener();
  final String requestId = producerContext.getId();
  final ImageRequest imageRequest = producerContext.getImageRequest();
  final Object callerContext = producerContext.getCallerContext();

  // If there's no postprocessor or the postprocessor doesn't require caching, forward results.
  final Postprocessor postprocessor = imageRequest.getPostprocessor();
  if (postprocessor == null || postprocessor.getPostprocessorCacheKey() == null) {
    mInputProducer.produceResults(consumer, producerContext);
    return;
  }
  listener.onProducerStart(requestId, getProducerName());
  final CacheKey cacheKey =
      mCacheKeyFactory.getPostprocessedBitmapCacheKey(imageRequest, callerContext);
  CloseableReference<CloseableImage> cachedReference = mMemoryCache.get(cacheKey);
  if (cachedReference != null) {
    listener.onProducerFinishWithSuccess(
        requestId,
        getProducerName(),
        listener.requiresExtraMap(requestId) ? ImmutableMap.of(VALUE_FOUND, "true") : null);
    listener.onUltimateProducerReached(requestId, PRODUCER_NAME, true);
    consumer.onProgressUpdate(1.0f);
    consumer.onNewResult(cachedReference, Consumer.IS_LAST);
    cachedReference.close();
  } else {
    final boolean isRepeatedProcessor = postprocessor instanceof RepeatedPostprocessor;
    Consumer<CloseableReference<CloseableImage>> cachedConsumer = new CachedPostprocessorConsumer(
        consumer,
        cacheKey,
        isRepeatedProcessor,
        mMemoryCache);
    listener.onProducerFinishWithSuccess(
        requestId,
        getProducerName(),
        listener.requiresExtraMap(requestId) ? ImmutableMap.of(VALUE_FOUND, "false") : null);
    mInputProducer.produceResults(cachedConsumer, producerContext);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:44,代码来源:PostprocessedBitmapMemoryCacheProducer.java

示例14: Entry

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
Entry(int descriptionId, Postprocessor postprocessor) {
  this.descriptionId = descriptionId;
  this.postprocessor = postprocessor;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:ImagePipelinePostProcessorFragment.java

示例15: buildRequest

import com.facebook.imagepipeline.request.Postprocessor; //导入依赖的package包/类
private ImageRequest buildRequest(ImageConfig config) {
    Uri uri = buildUriByType(config);

    ImageRequestBuilder builder =   ImageRequestBuilder.newBuilderWithSource(uri);
    Postprocessor postprocessor=null;


    ResizeOptions resizeOptions = getResizeOption(config);


    builder.setPostprocessor(postprocessor)
            .setResizeOptions(resizeOptions)//缩放,在解码前修改内存中的图片大小, 配合Downsampling可以处理所有图片,否则只能处理jpg,
            // 开启Downsampling:在初始化时设置.setDownsampleEnabled(true)
            .setAutoRotateEnabled(true);




    return builder.build();
}
 
开发者ID:BaoBaoJianqiang,项目名称:CustomListView,代码行数:21,代码来源:FrescoImageLoaderStrategy.java


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