本文整理汇总了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
}
示例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);
}
});
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例7: saveCachedVariant
import com.facebook.imagepipeline.request.ImageRequest; //导入方法依赖的package包/类
void saveCachedVariant(
String mediaId,
ImageRequest.CacheChoice cacheChoice,
CacheKey cacheKey,
EncodedImage encodedImage);