當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。