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


Java ImageRequest.CacheChoice方法代码示例

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


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

示例1: saveCachedVariant

import com.facebook.imagepipeline.request.ImageRequest; //导入方法依赖的package包/类
@Override
public void saveCachedVariant(
    String mediaId,
    ImageRequest.CacheChoice cacheChoice,
    CacheKey cacheKey,
    EncodedImage encodedImage) {
  // no-op
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:NoOpMediaVariationsIndex.java

示例2: saveCachedVariant

import com.facebook.imagepipeline.request.ImageRequest; //导入方法依赖的package包/类
@Override
public void saveCachedVariant(
    final String mediaId,
    final ImageRequest.CacheChoice cacheChoice,
    final CacheKey cacheKey,
    final EncodedImage encodedImage) {
  mWriteExecutor.execute(new Runnable() {
    @Override
    public void run() {
      saveCachedVariantSync(mediaId, cacheChoice, cacheKey, encodedImage);
    }
  });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:MediaVariationsIndexDatabase.java

示例3: attemptCacheReadForVariant

import com.facebook.imagepipeline.request.ImageRequest; //导入方法依赖的package包/类
private Task attemptCacheReadForVariant(
    final Consumer<EncodedImage> consumer,
    final ProducerContext producerContext,
    ImageRequest imageRequest,
    MediaVariations mediaVariations,
    List<MediaVariations.Variant> sortedVariants,
    int index,
    AtomicBoolean isCancelled) {
  final MediaVariations.Variant variant = sortedVariants.get(index);
  final CacheKey cacheKey = mCacheKeyFactory
      .getEncodedCacheKey(imageRequest, variant.getUri(), producerContext.getCallerContext());
  final ImageRequest.CacheChoice cacheChoice;
  if (variant.getCacheChoice() == null) {
    cacheChoice = imageRequest.getCacheChoice();
  } else {
    cacheChoice = variant.getCacheChoice();
  }
  final BufferedDiskCache preferredCache = cacheChoice == ImageRequest.CacheChoice.SMALL
      ? mSmallImageBufferedDiskCache
      : mDefaultBufferedDiskCache;

  Task<EncodedImage> readTask = preferredCache.get(cacheKey, isCancelled);

  Continuation<EncodedImage, Void> continuation = onFinishDiskReads(
      consumer,
      producerContext,
      imageRequest,
      mediaVariations,
      sortedVariants,
      index,
      isCancelled);
  return readTask.continueWith(continuation);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:34,代码来源:MediaVariationsFallbackProducer.java

示例4: storeResultInDatabase

import com.facebook.imagepipeline.request.ImageRequest; //导入方法依赖的package包/类
private void storeResultInDatabase(EncodedImage newResult) {
  final ImageRequest imageRequest = mProducerContext.getImageRequest();

  if (!imageRequest.isDiskCacheEnabled() || mMediaId == null) {
    return;
  }

  final ImageRequest.CacheChoice cacheChoice = imageRequest.getCacheChoice() == null
      ? ImageRequest.CacheChoice.DEFAULT
      : imageRequest.getCacheChoice();
  final CacheKey cacheKey =
      mCacheKeyFactory.getEncodedCacheKey(imageRequest, mProducerContext.getCallerContext());

  mMediaVariationsIndex.saveCachedVariant(mMediaId, cacheChoice, cacheKey, newResult);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:MediaVariationsFallbackProducer.java

示例5: isInDiskCacheSync

import com.facebook.imagepipeline.request.ImageRequest; //导入方法依赖的package包/类
/**
 * Performs disk cache check synchronously. It is not recommended to use this
 * unless you know what exactly you are doing. Disk cache check is a costly operation,
 * the call will block the caller thread until the cache check is completed.
 *
 * @param imageRequest the imageRequest for the image to be looked up.
 * @return true if the image was found in the disk cache, false otherwise.
 */
public boolean isInDiskCacheSync(final ImageRequest imageRequest) {
  final CacheKey cacheKey = mCacheKeyFactory.getEncodedCacheKey(imageRequest, null);
  final ImageRequest.CacheChoice cacheChoice = imageRequest.getCacheChoice();

  switch (cacheChoice) {
    case DEFAULT:
      return mMainBufferedDiskCache.diskCheckSync(cacheKey);
    case SMALL:
      return mSmallImageBufferedDiskCache.diskCheckSync(cacheKey);
    default:
      return false;
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:ImagePipeline.java

示例6: assertVariantIsEqualTo

import com.facebook.imagepipeline.request.ImageRequest; //导入方法依赖的package包/类
private static void assertVariantIsEqualTo(
    MediaVariations.Variant variant,
    Uri uri,
    int width,
    int height,
    ImageRequest.CacheChoice cacheChoice) {
  assertThat(variant.getUri()).isEqualTo(uri);
  assertThat(variant.getWidth()).isEqualTo(width);
  assertThat(variant.getHeight()).isEqualTo(height);
  assertThat(variant.getCacheChoice()).isEqualTo(cacheChoice);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:MediaVariationsIndexDatabaseTest.java

示例7: saveCachedVariant

import com.facebook.imagepipeline.request.ImageRequest; //导入方法依赖的package包/类
void saveCachedVariant(
String mediaId,
ImageRequest.CacheChoice cacheChoice,
CacheKey cacheKey,
EncodedImage encodedImage);
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:MediaVariationsIndex.java


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