本文整理汇总了Java中com.facebook.imagepipeline.common.Priority.MEDIUM属性的典型用法代码示例。如果您正苦于以下问题:Java Priority.MEDIUM属性的具体用法?Java Priority.MEDIUM怎么用?Java Priority.MEDIUM使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.facebook.imagepipeline.common.Priority
的用法示例。
在下文中一共展示了Priority.MEDIUM属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mExecutor = new TestExecutorService(new FakeClock());
mQualifiedResourceFetchProducer = new QualifiedResourceFetchProducer(
mExecutor,
mPooledByteBufferFactory,
mContentResolver);
mContentUri = UriUtil.getUriForQualifiedResource(PACKAGE_NAME, RESOURCE_ID);
mProducerContext = new SettableProducerContext(
mImageRequest,
REQUEST_ID,
mProducerListener,
CALLER_CONTEXT,
ImageRequest.RequestLevel.FULL_FETCH,
false,
true,
Priority.MEDIUM);
when(mImageRequest.getSourceUri()).thenReturn(mContentUri);
}
示例2: setUp
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mExecutor = new TestExecutorService(new FakeClock());
mLocalVideoThumbnailProducer = new LocalVideoThumbnailProducer(
mExecutor,
RuntimeEnvironment.application.getContentResolver());
mFile = new File(RuntimeEnvironment.application.getExternalFilesDir(null), TEST_FILENAME);
mockStatic(ThumbnailUtils.class);
mProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mock(Object.class),
ImageRequest.RequestLevel.FULL_FETCH,
false,
false,
Priority.MEDIUM);
when(mImageRequest.getSourceFile()).thenReturn(mFile);
}
示例3: setUp
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mock(Object.class),
ImageRequest.RequestLevel.FULL_FETCH,
false,
true,
Priority.MEDIUM);
mTestExecutorService = new TestExecutorService(new FakeClock());
mThreadHandoffProducer = new ThreadHandoffProducer(
mInputProducer,
new ThreadHandoffProducerQueue(mTestExecutorService));
}
示例4: setUp
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mTestExecutorService = new TestExecutorService(new FakeClock());
mPostprocessorProducer =
new PostprocessorProducer(
mInputProducer,
mPlatformBitmapFactory,
mTestExecutorService);
mProducerContext =
new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mock(Object.class),
ImageRequest.RequestLevel.FULL_FETCH,
false /* isPrefetch */,
false /* isIntermediateResultExpected */,
Priority.MEDIUM);
when(mImageRequest.getPostprocessor()).thenReturn(mPostprocessor);
mResults = new ArrayList<>();
when(mPostprocessor.getName()).thenReturn(POSTPROCESSOR_NAME);
when(mProducerListener.requiresExtraMap(mRequestId)).thenReturn(true);
doAnswer(
new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
mResults.add(
((CloseableReference<CloseableImage>) invocation.getArguments()[0]).clone());
return null;
}
}
).when(mConsumer).onNewResult(any(CloseableReference.class), anyInt());
mInOrder = inOrder(mPostprocessor, mProducerListener, mConsumer);
}
示例5: setUp
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(mAssetManager.openFd(eq(TEST_FILENAME))).thenReturn(mAssetFileDescriptor);
when(mAssetFileDescriptor.getLength()).thenReturn((long) TEST_DATA_LENGTH);
when(mPooledByteBufferFactory.newByteBuffer(any(InputStream.class), eq(TEST_DATA_LENGTH)))
.thenReturn(mPooledByteBuffer);
mExecutor = new TestExecutorService(new FakeClock());
mLocalAssetFetchProducer = new LocalAssetFetchProducer(
mExecutor,
mPooledByteBufferFactory,
mAssetManager
);
mProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mock(Object.class),
ImageRequest.RequestLevel.FULL_FETCH,
false,
true,
Priority.MEDIUM);
when(mImageRequest.getSourceUri()).thenReturn(Uri.parse("asset:///" + TEST_FILENAME));
doAnswer(
new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
mCapturedEncodedImage =
EncodedImage.cloneOrNull((EncodedImage) invocation.getArguments()[0]);
return null;
}
})
.when(mConsumer)
.onNewResult(notNull(EncodedImage.class), anyInt());
}
示例6: setUp
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(mResources.openRawResourceFd(eq(TEST_ID))).thenReturn(mAssetFileDescriptor);
when(mAssetFileDescriptor.getLength()).thenReturn((long) TEST_DATA_LENGTH);
mExecutor = new TestExecutorService(new FakeClock());
mLocalResourceFetchProducer = new LocalResourceFetchProducer(
mExecutor,
mPooledByteBufferFactory,
mResources
);
mProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mock(Object.class),
ImageRequest.RequestLevel.FULL_FETCH,
false,
true,
Priority.MEDIUM);
when(mImageRequest.getSourceUri()).thenReturn(Uri.parse("res:///" + TEST_ID));
doAnswer(
new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
mCapturedEncodedImage =
EncodedImage.cloneOrNull(((EncodedImage) invocation.getArguments()[0]));
return null;
}
})
.when(mConsumer)
.onNewResult(notNull(EncodedImage.class), anyInt());
}
示例7: setUp
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
PowerMockito.mockStatic(SystemClock.class);
mNetworkFetchProducer = new NetworkFetchProducer(
mPooledByteBufferFactory,
mByteArrayPool,
mNetworkFetcher);
mProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mock(Object.class),
ImageRequest.RequestLevel.FULL_FETCH,
false /* isPrefetch */,
true /* isIntermediateResultExpected */,
Priority.MEDIUM);
mFetchState = new FetchState(mConsumer, mProducerContext);
mCommonByteArray = new byte[10];
when(mByteArrayPool.get(anyInt())).thenReturn(mCommonByteArray);
when(mPooledByteBufferFactory.newOutputStream(anyInt()))
.thenReturn(mPooledByteBufferOutputStream);
when(mPooledByteBufferFactory.newOutputStream())
.thenReturn(mPooledByteBufferOutputStream);
when(mPooledByteBufferOutputStream.toByteBuffer()).thenReturn(mPooledByteBuffer);
when(mProducerListener.requiresExtraMap(anyString())).thenReturn(true);
when(mNetworkFetcher.getExtraMap(any(FetchState.class), anyInt())).thenReturn(mExtrasMap);
when(mNetworkFetcher.createFetchState(eq(mConsumer), eq(mProducerContext)))
.thenReturn(mFetchState);
mTestExecutor = Executors.newCachedThreadPool();
}
示例8: setupImageRequest
private void setupImageRequest(String requestId, ImageRequest imageRequest) {
mImageRequest = imageRequest;
mRequestId = requestId;
mProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mock(Object.class),
ImageRequest.RequestLevel.FULL_FETCH,
/* isPrefetch */ false,
/* isIntermediateResultExpected */ true,
Priority.MEDIUM);
}
示例9: setUp
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mExecutor = new TestExecutorService(new FakeClock());
mLocalContentUriFetchProducer = new LocalContentUriFetchProducer(
mExecutor,
mPooledByteBufferFactory,
mContentResolver
);
mContentUri = Uri.fromFile(mock(File.class));
mProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mock(Object.class),
ImageRequest.RequestLevel.FULL_FETCH,
false,
true,
Priority.MEDIUM);
when(mImageRequest.getSourceUri()).thenReturn(mContentUri);
doAnswer(
new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
mCapturedEncodedImage =
EncodedImage.cloneOrNull((EncodedImage) invocation.getArguments()[0]);
return null;
}
})
.when(mConsumer)
.onNewResult(notNull(EncodedImage.class), anyInt());
}
示例10: setUp
@Before
public void setUp() {
mSettableProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mock(ProducerListener.class),
mock(Object.class),
ImageRequest.RequestLevel.FULL_FETCH,
false,
true,
Priority.MEDIUM);
mCallbacks1 = mock(ProducerContextCallbacks.class);
mCallbacks2 = mock(ProducerContextCallbacks.class);
}
示例11: setUp
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mExecutor = new TestExecutorService(new FakeClock());
mLocalFileFetchProducer =
new LocalFileFetchProducer(mExecutor, mPooledByteBufferFactory);
mFile = new File(RuntimeEnvironment.application.getExternalFilesDir(null), TEST_FILENAME);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(mFile));
bos.write(new byte[INPUT_STREAM_LENGTH], 0 , INPUT_STREAM_LENGTH);
bos.close();
mProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mock(Object.class),
ImageRequest.RequestLevel.FULL_FETCH,
false,
true,
Priority.MEDIUM);
when(mImageRequest.getSourceFile()).thenReturn(mFile);
doAnswer(
new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
mCapturedEncodedImage =
EncodedImage.cloneOrNull((EncodedImage) invocation.getArguments()[0]);
return null;
}
})
.when(mConsumer)
.onNewResult(notNull(EncodedImage.class), anyInt());
}
示例12: setUp
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mExecutor = new TestExecutorService(new FakeClock());
mLocalContentUriThumbnailFetchProducer = new LocalContentUriThumbnailFetchProducer(
mExecutor,
mPooledByteBufferFactory,
mContentResolver
);
mContentUri = Uri.parse("content://media/external/images/media/1");
mProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mock(Object.class),
ImageRequest.RequestLevel.FULL_FETCH,
false,
true,
Priority.MEDIUM);
when(mImageRequest.getSourceUri()).thenReturn(mContentUri);
mockMediaStoreCursor();
mockThumbnailFile();
mockContentResolver();
}
示例13: setup
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mMediaVariationsFallbackProducer = new MediaVariationsFallbackProducer(
mDefaultBufferedDiskCache,
mSmallImageBufferedDiskCache,
mCacheKeyFactory,
mMediaVariationsIndex,
mInputProducer);
mProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mCallerContext,
ImageRequest.RequestLevel.FULL_FETCH,
false,
true,
Priority.MEDIUM);
mMediaVariationsWithVariants = MediaVariations.newBuilderForMediaId(MEDIA_ID)
.addVariant(URI_S, SIZE_S, SIZE_S)
.addVariant(URI_M, SIZE_M, SIZE_M)
.addVariant(URI_L, SIZE_L, SIZE_L)
.build();
mEmptyMediaVariations = MediaVariations.newBuilderForMediaId(MEDIA_ID).build();
when(mImageRequest.getSourceUri()).thenReturn(URI_ORIGINAL);
when(mImageRequest.getCacheChoice()).thenReturn(CacheChoice.DEFAULT);
when(mImageRequest.getResizeOptions()).thenReturn(new ResizeOptions(SIZE_M, SIZE_M));
when(mImageRequest.isDiskCacheEnabled()).thenReturn(true);
when(mProducerListener.requiresExtraMap(mRequestId)).thenReturn(true);
when(mCacheKeyFactory.getEncodedCacheKey(mImageRequest, mCallerContext))
.thenReturn(CACHE_KEY_ORIGINAL);
when(mCacheKeyFactory.getEncodedCacheKey(mImageRequest, URI_S, mCallerContext))
.thenReturn(CACHE_KEY_S);
when(mCacheKeyFactory.getEncodedCacheKey(mImageRequest, URI_M, mCallerContext))
.thenReturn(CACHE_KEY_M);
when(mCacheKeyFactory.getEncodedCacheKey(mImageRequest, URI_L, mCallerContext))
.thenReturn(CACHE_KEY_L);
whenIndexDbContainsNoMatchingVariants();
when(mDefaultBufferedDiskCache.get(any(CacheKey.class), any(AtomicBoolean.class)))
.thenReturn(Task.<EncodedImage>forResult(null));
when(mSmallImageBufferedDiskCache.get(any(CacheKey.class), any(AtomicBoolean.class)))
.thenReturn(Task.<EncodedImage>forResult(null));
}
示例14: setUp
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mDiskCacheWriteProducer = new DiskCacheWriteProducer(
mDefaultBufferedDiskCache,
mSmallImageBufferedDiskCache,
mCacheKeyFactory,
mInputProducer
);
List<CacheKey> keys = new ArrayList<>(1);
keys.add(new SimpleCacheKey("http://dummy.uri"));
mCacheKey = new MultiCacheKey(keys);
mIntermediatePooledByteBuffer = mock(PooledByteBuffer.class);
mFinalPooledByteBuffer = mock(PooledByteBuffer.class);
mIntermediateImageReference = CloseableReference.of(mIntermediatePooledByteBuffer);
mFinalImageReference = CloseableReference.of(mFinalPooledByteBuffer);
mIntermediateEncodedImage = new EncodedImage(mIntermediateImageReference);
mFinalEncodedImage = new EncodedImage(mFinalImageReference);
mProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mCallerContext,
ImageRequest.RequestLevel.FULL_FETCH,
false,
true,
Priority.MEDIUM);
mLowestLevelProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mCallerContext,
ImageRequest.RequestLevel.DISK_CACHE,
false,
true,
Priority.MEDIUM);
when(mProducerListener.requiresExtraMap(mRequestId)).thenReturn(true);
when(mCacheKeyFactory.getEncodedCacheKey(mImageRequest, mCallerContext)).thenReturn(mCacheKey);
when(mImageRequest.getCacheChoice()).thenReturn(ImageRequest.CacheChoice.DEFAULT);
when(mImageRequest.isDiskCacheEnabled()).thenReturn(true);
}
示例15: setUp
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mDiskCacheReadProducer = new DiskCacheReadProducer(
mDefaultBufferedDiskCache,
mSmallImageBufferedDiskCache,
mCacheKeyFactory,
mInputProducer
);
List<CacheKey> keys = new ArrayList<>(1);
keys.add(new SimpleCacheKey("http://dummy.uri"));
mCacheKey = new MultiCacheKey(keys);
mIntermediatePooledByteBuffer = mock(PooledByteBuffer.class);
mFinalPooledByteBuffer = mock(PooledByteBuffer.class);
mIntermediateImageReference = CloseableReference.of(mIntermediatePooledByteBuffer);
mFinalImageReference = CloseableReference.of(mFinalPooledByteBuffer);
mIntermediateEncodedImage = new EncodedImage(mIntermediateImageReference);
mFinalEncodedImage = new EncodedImage(mFinalImageReference);
mIsCancelled = ArgumentCaptor.forClass(AtomicBoolean.class);
mProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mCallerContext,
ImageRequest.RequestLevel.FULL_FETCH,
false,
true,
Priority.MEDIUM);
mLowestLevelProducerContext = new SettableProducerContext(
mImageRequest,
mRequestId,
mProducerListener,
mCallerContext,
ImageRequest.RequestLevel.DISK_CACHE,
false,
true,
Priority.MEDIUM);
when(mProducerListener.requiresExtraMap(mRequestId)).thenReturn(true);
when(mCacheKeyFactory.getEncodedCacheKey(mImageRequest, mCallerContext)).thenReturn(mCacheKey);
when(mImageRequest.getCacheChoice()).thenReturn(ImageRequest.CacheChoice.DEFAULT);
when(mImageRequest.isDiskCacheEnabled()).thenReturn(true);
}