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


Java Priority类代码示例

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


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


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