• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Priority类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.facebook.imagepipeline.common.Priority的典型用法代码示例。如果您正苦于以下问题:Java Priority类的具体用法?Java Priority怎么用?Java Priority使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Priority类属于com.facebook.imagepipeline.common包,在下文中一共展示了Priority类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: SettableProducerContext

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
public SettableProducerContext(
    ImageRequest imageRequest,
    String id,
    ProducerListener producerListener,
    Object callerContext,
    ImageRequest.RequestLevel lowestPermittedRequestLevel,
    boolean isPrefetch,
    boolean isIntermediateResultExpected,
    Priority priority) {
  super(
      imageRequest,
      id,
      producerListener,
      callerContext,
      lowestPermittedRequestLevel,
      isPrefetch,
      isIntermediateResultExpected,
      priority);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:SettableProducerContext.java


示例2: BaseProducerContext

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
public BaseProducerContext(
    ImageRequest imageRequest,
    String id,
    ProducerListener producerListener,
    Object callerContext,
    ImageRequest.RequestLevel lowestPermittedRequestLevel,
    boolean isPrefetch,
    boolean isIntermediateResultExpected,
    Priority priority) {
  mImageRequest = imageRequest;
  mId = id;
  mProducerListener = producerListener;
  mCallerContext = callerContext;
  mLowestPermittedRequestLevel = lowestPermittedRequestLevel;

  mIsPrefetch = isPrefetch;
  mPriority = priority;
  mIsIntermediateResultExpected = isIntermediateResultExpected;

  mIsCancelled = false;
  mCallbacks = new ArrayList<>();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:BaseProducerContext.java


示例3: prefetchToBitmapCache

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
/**
 * Submits a request for prefetching to the bitmap cache.
 *
 * <p> Beware that if your network fetcher doesn't support priorities prefetch requests may slow
 * down images which are immediately required on screen.
 *
 * @param imageRequest the request to submit
 * @return a DataSource that can safely be ignored.
 */
public DataSource<Void> prefetchToBitmapCache(
    ImageRequest imageRequest,
    Object callerContext) {
  if (!mIsPrefetchEnabledSupplier.get()) {
    return DataSources.immediateFailedDataSource(PREFETCH_EXCEPTION);
  }
  try {
    Producer<Void> producerSequence = mSuppressBitmapPrefetchingSupplier.get()
        ? mProducerSequenceFactory.getEncodedImagePrefetchProducerSequence(imageRequest)
        : mProducerSequenceFactory.getDecodedImagePrefetchProducerSequence(imageRequest);
    return submitPrefetchRequest(
        producerSequence,
        imageRequest,
        ImageRequest.RequestLevel.FULL_FETCH,
        callerContext,
        Priority.MEDIUM);
  } catch (Exception exception) {
    return DataSources.immediateFailedDataSource(exception);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:ImagePipeline.java


示例4: prefetchToDiskCache

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
/**
 * Submits a request for prefetching to the disk cache.
 *
 * <p> Beware that if your network fetcher doesn't support priorities prefetch requests may slow
 * down images which are immediately required on screen.
 *
 * @param imageRequest the request to submit
 * @param priority custom priority for the fetch
 * @return a DataSource that can safely be ignored.
 */
public DataSource<Void> prefetchToDiskCache(
    ImageRequest imageRequest,
    Object callerContext,
    Priority priority) {
  if (!mIsPrefetchEnabledSupplier.get()) {
    return DataSources.immediateFailedDataSource(PREFETCH_EXCEPTION);
  }
  try {
    Producer<Void> producerSequence =
        mProducerSequenceFactory.getEncodedImagePrefetchProducerSequence(imageRequest);
    return submitPrefetchRequest(
        producerSequence,
        imageRequest,
        ImageRequest.RequestLevel.FULL_FETCH,
        callerContext,
        priority);
  } catch (Exception exception) {
    return DataSources.immediateFailedDataSource(exception);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:ImagePipeline.java


示例5: testCreatingRequestFromExistingRequest

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@Test
public void testCreatingRequestFromExistingRequest() {
  ImageRequest original = ImageRequestBuilder
      .newBuilderWithSource(Uri.parse("http://frescolib.org/image.jpg"))
          .setCacheChoice(ImageRequest.CacheChoice.SMALL)
      .setImageDecodeOptions(new ImageDecodeOptionsBuilder().build())
      .setLocalThumbnailPreviewsEnabled(true)
      .setLowestPermittedRequestLevel(ImageRequest.RequestLevel.DISK_CACHE)
      .setMediaVariations(MediaVariations.forMediaId("A113"))
      .setPostprocessor(new BasePostprocessor() {
        @Override
        public String getName() {
          return super.getName();
        }
      })
      .setProgressiveRenderingEnabled(true)
      .setRequestListener(new RequestLoggingListener())
      .setResizeOptions(new ResizeOptions(20, 20))
      .setRotationOptions(RotationOptions.forceRotation(RotationOptions.ROTATE_90))
      .setRequestPriority(Priority.HIGH)
      .build();

  ImageRequest copy = ImageRequestBuilder.fromRequest(original).build();

  assertThat(copy).isEqualTo(original);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:ImageRequestTest.java


示例6: testGetHigherPriority

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@Test
public void testGetHigherPriority() throws Exception {
  assertEquals(HIGH, Priority.getHigherPriority(null, HIGH));
  assertEquals(HIGH, Priority.getHigherPriority(LOW, HIGH));
  assertEquals(HIGH, Priority.getHigherPriority(MEDIUM, HIGH));
  assertEquals(HIGH, Priority.getHigherPriority(HIGH, HIGH));
  assertEquals(HIGH, Priority.getHigherPriority(HIGH, MEDIUM));
  assertEquals(HIGH, Priority.getHigherPriority(HIGH, LOW));
  assertEquals(HIGH, Priority.getHigherPriority(HIGH, null));

  assertEquals(MEDIUM, Priority.getHigherPriority(null, MEDIUM));
  assertEquals(MEDIUM, Priority.getHigherPriority(LOW, MEDIUM));
  assertEquals(MEDIUM, Priority.getHigherPriority(MEDIUM, MEDIUM));
  assertEquals(MEDIUM, Priority.getHigherPriority(MEDIUM, LOW));
  assertEquals(MEDIUM, Priority.getHigherPriority(MEDIUM, null));

  assertEquals(LOW, Priority.getHigherPriority(null, LOW));
  assertEquals(LOW, Priority.getHigherPriority(LOW, LOW));
  assertEquals(LOW, Priority.getHigherPriority(LOW, null));

  assertEquals(null, Priority.getHigherPriority(null, null));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:PriorityTest.java


示例7: setUp

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@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,代码行数:22,代码来源:QualifiedResourceFetchProducerTest.java


示例8: setUp

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@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,代码行数:22,代码来源:LocalVideoThumbnailProducerTest.java


示例9: setUp

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@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,代码行数:18,代码来源:ThreadHandoffProducerTest.java


示例10: testPrefetchToBitmapCache

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@Test
public void testPrefetchToBitmapCache() {
  Producer<Void> prefetchProducerSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImagePrefetchProducerSequence(mImageRequest))
      .thenReturn(prefetchProducerSequence);
  DataSource<Void> dataSource =
      mImagePipeline.prefetchToBitmapCache(mImageRequest, mCallerContext);
  assertTrue(!dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0",  true);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", true);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(prefetchProducerSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertFalse(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.MEDIUM);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:ImagePipelineTest.java


示例11: testFetchDecodedImage

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@Test
public void testFetchDecodedImage() {
  Producer<CloseableReference<CloseableImage>> decodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(decodedSequence);
  DataSource<CloseableReference<CloseableImage>> dataSource =
      mImagePipeline.fetchDecodedImage(mImageRequest, mCallerContext);
  assertFalse(dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(decodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:ImagePipelineTest.java


示例12: testFetchDecodedImageWithRequestLevel

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@Test
public void testFetchDecodedImageWithRequestLevel() {
  Producer<CloseableReference<CloseableImage>> decodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(decodedSequence);
  DataSource<CloseableReference<CloseableImage>> dataSource =
      mImagePipeline.fetchDecodedImage(
          mImageRequest,
          mCallerContext,
          ImageRequest.RequestLevel.DISK_CACHE);
  assertFalse(dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(decodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
  assertEquals(
      producerContextArgumentCaptor.getValue().getLowestPermittedRequestLevel(),
      ImageRequest.RequestLevel.DISK_CACHE);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:ImagePipelineTest.java


示例13: testFetchFromBitmapCacheDueToMethodCall

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@Test
public void testFetchFromBitmapCacheDueToMethodCall() {
  Producer<CloseableReference<CloseableImage>> bitmapCacheSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(bitmapCacheSequence);
  mImagePipeline.fetchImageFromBitmapCache(mImageRequest, mCallerContext);
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(bitmapCacheSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
  assertEquals(
      producerContextArgumentCaptor.getValue().getLowestPermittedRequestLevel(),
      ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:ImagePipelineTest.java


示例14: testFetchFromBitmapCacheDueToImageRequest

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@Test
public void testFetchFromBitmapCacheDueToImageRequest() {
  Producer<CloseableReference<CloseableImage>> bitmapCacheSequence = mock(Producer.class);
  when(mImageRequest.getLowestPermittedRequestLevel())
      .thenReturn(ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(bitmapCacheSequence);
  mImagePipeline.fetchDecodedImage(mImageRequest, mCallerContext);
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0",  false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(bitmapCacheSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
  assertEquals(
      producerContextArgumentCaptor.getValue().getLowestPermittedRequestLevel(),
      ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:ImagePipelineTest.java


示例15: testGetBitmapCacheGetSupplier

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@Test
public void testGetBitmapCacheGetSupplier() {
  Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier =
      mImagePipeline.getDataSourceSupplier(
          mImageRequest,
          mCallerContext,
          ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
  Producer<CloseableReference<CloseableImage>> bitmapCacheSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(bitmapCacheSequence);
  dataSourceSupplier.get();
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0",  false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(bitmapCacheSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:ImagePipelineTest.java


示例16: testGetFullFetchSupplier

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@Test
public void testGetFullFetchSupplier() {
  Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier = mImagePipeline
      .getDataSourceSupplier(mImageRequest, mCallerContext, ImageRequest.RequestLevel.FULL_FETCH);
  Producer<CloseableReference<CloseableImage>> decodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(decodedSequence);
  DataSource<CloseableReference<CloseableImage>> dataSource = dataSourceSupplier.get();
  assertFalse(dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(decodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:ImagePipelineTest.java


示例17: setUp

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@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,代码行数:36,代码来源:AnimatedRepeatedPostprocessorProducerTest.java


示例18: computePriority

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
private synchronized Priority computePriority() {
  Priority priority = Priority.LOW;
  for (Pair<Consumer<T>, ProducerContext> pair : mConsumerContextPairs) {
    priority = Priority.getHigherPriority(priority, pair.second.getPriority());
  }
  return priority;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:MultiplexProducer.java


示例19: submitPrefetchRequest

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
private DataSource<Void> submitPrefetchRequest(
    Producer<Void> producerSequence,
    ImageRequest imageRequest,
    ImageRequest.RequestLevel lowestPermittedRequestLevelOnSubmit,
    Object callerContext,
    Priority priority) {
  final RequestListener requestListener = getRequestListenerForRequest(imageRequest);

  try {
    ImageRequest.RequestLevel lowestPermittedRequestLevel =
        ImageRequest.RequestLevel.getMax(
            imageRequest.getLowestPermittedRequestLevel(),
            lowestPermittedRequestLevelOnSubmit);
    SettableProducerContext settableProducerContext = new SettableProducerContext(
        imageRequest,
        generateUniqueFutureId(),
        requestListener,
        callerContext,
        lowestPermittedRequestLevel,
      /* isPrefetch */ true,
      /* isIntermediateResultExpected */ false,
        priority);
    return ProducerToDataSourceAdapter.create(
        producerSequence,
        settableProducerContext,
        requestListener);
  } catch (Exception exception) {
    return DataSources.immediateFailedDataSource(exception);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:ImagePipeline.java


示例20: setUp

import com.facebook.imagepipeline.common.Priority; //导入依赖的package包/类
@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,代码行数:38,代码来源:LocalAssetFetchProducerTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClassBodyEvaluator类代码示例发布时间:2022-05-22
下一篇:
Java AsyncReporter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap