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


Java Priority.MEDIUM属性代码示例

本文整理汇总了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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:QualifiedResourceFetchProducerTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:LocalVideoThumbnailProducerTest.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:ThreadHandoffProducerTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:AnimatedRepeatedPostprocessorProducerTest.java

示例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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:LocalAssetFetchProducerTest.java

示例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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:LocalResourceFetchProducerTest.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:NetworkFetchProducerTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:DecodeProducerTest.java

示例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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:LocalContentUriFetchProducerTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:SettableProducerContextTest.java

示例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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:LocalFileFetchProducerTest.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:LocalContentUriThumbnailFetchProducerTest.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:50,代码来源:MediaVariationsFallbackProducerTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:42,代码来源:DiskCacheWriteProducerTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:DiskCacheReadProducerTest.java


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