浅谈 Fresco 框架结构

ProducerContext 的作用
主要是用来将上下文信息传递给 Producer;可以具体看看代码,可以发现 context 内部包含很多逻辑。

复制代码
public interface ProducerContext {

@StringDef({
ExtraKeys.ORIGIN,
ExtraKeys.ORIGIN_SUBCATEGORY,
ExtraKeys.NORMALIZED_URI,
ExtraKeys.SOURCE_URI,
ExtraKeys.ENCODED_WIDTH,
ExtraKeys.ENCODED_HEIGHT,
ExtraKeys.ENCODED_SIZE,
ExtraKeys.MULTIPLEX_BITMAP_COUNT,
ExtraKeys.MULTIPLEX_ENCODED_COUNT,
})
@interface ExtraKeys {
String ORIGIN = “origin”;
String ORIGIN_SUBCATEGORY = “origin_sub”;
String SOURCE_URI = “uri_source”;
String NORMALIZED_URI = “uri_norm”;
String ENCODED_WIDTH = “encoded_width”;
String ENCODED_HEIGHT = “encoded_height”;
String ENCODED_SIZE = “encoded_size”;
/* number of deduped request in BitmapMemoryCacheKeyMultiplexProducer /
String MULTIPLEX_BITMAP_COUNT = “multiplex_bmp_cnt”;
/
number of deduped request in EncodedCacheKeyMultiplexProducer */
String MULTIPLEX_ENCODED_COUNT = “multiplex_enc_cnt”;
}

/** @return image request that is being executed */
ImageRequest getImageRequest();

/** @return id of this request */
String getId();

/** @return optional id of the UI component requesting the image */
@Nullable
String getUiComponentId();

/** @return ProducerListener2 for producer’s events */
ProducerListener2 getProducerListener();

/** @return the {@link Object} that indicates the caller’s context */
Object getCallerContext();

/** @return the lowest permitted {@link ImageRequest.RequestLevel} */
ImageRequest.RequestLevel getLowestPermittedRequestLevel();

/** @return true if the request is a prefetch, false otherwise. */
boolean isPrefetch();

/** @return priority of the request. */
Priority getPriority();

/** @return true if request’s owner expects intermediate results */
boolean isIntermediateResultExpected();

/**

  • Adds callbacks to the set of callbacks that are executed at various points during the
  • processing of a request.
  • @param callbacks callbacks to be executed
    */
    void addCallbacks(ProducerContextCallbacks callbacks);

ImagePipelineConfig getImagePipelineConfig();

EncodedImageOrigin getEncodedImageOrigin();

void setEncodedImageOrigin(EncodedImageOrigin encodedImageOrigin);

void setExtra(@ExtraKeys String key, @Nullable E value);

void putExtras(@Nullable Map<String, ?> extras);

@Nullable
E getExtra(String key);

@Nullable
E getExtra(String key, @Nullable E valueIfNotFound);

Map<String, Object> getExtras();

/** Helper to set {@link ExtraKeys#ORIGIN} and {@link ExtraKeys#ORIGIN_SUBCATEGORY} */
void putOriginExtra(@Nullable String origin, @Nullable String subcategory);

/** Helper to set {@link ExtraKeys#ORIGIN} */
void putOriginExtra(@Nullable String origin);
}
USB Microphone https://www.soft-voice.com/
Wooden Speakers https://www.zeshuiplatform.com/
亚马逊测评 www.yisuping.cn
深圳网站建设www.sz886.com

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值