本文整理匯總了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);