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


Java Supplier类代码示例

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


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

示例1: init

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
public void init(
    Resources resources,
    DeferredReleaser deferredReleaser,
    DrawableFactory animatedDrawableFactory,
    Executor uiThreadExecutor,
    MemoryCache<CacheKey, CloseableImage> memoryCache,
    @Nullable ImmutableList<DrawableFactory> drawableFactories,
    @Nullable Supplier<Boolean> debugOverlayEnabledSupplier) {
  mResources = resources;
  mDeferredReleaser = deferredReleaser;
  mAnimatedDrawableFactory = animatedDrawableFactory;
  mUiThreadExecutor = uiThreadExecutor;
  mMemoryCache = memoryCache;
  mDrawableFactories = drawableFactories;
  mDebugOverlayEnabledSupplier = debugOverlayEnabledSupplier;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:PipelineDraweeControllerFactory.java

示例2: newController

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
public PipelineDraweeController newController(
    Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
    String id,
    CacheKey cacheKey,
    Object callerContext,
    @Nullable ImmutableList<DrawableFactory> customDrawableFactories) {
  Preconditions.checkState(mResources != null, "init() not called");
  // Field values passed as arguments so that any subclass of PipelineDraweeControllerFactory
  // can simply override internalCreateController() and return a custom Drawee controller
  PipelineDraweeController controller = internalCreateController(
      mResources,
      mDeferredReleaser,
      mAnimatedDrawableFactory,
      mUiThreadExecutor,
      mMemoryCache,
      mDrawableFactories,
      customDrawableFactories,
      dataSourceSupplier,
      id,
      cacheKey,
      callerContext);
  if (mDebugOverlayEnabledSupplier != null) {
    controller.setDrawDebugOverlay(mDebugOverlayEnabledSupplier.get());
  }
  return controller;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:PipelineDraweeControllerFactory.java

示例3: internalCreateController

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
protected PipelineDraweeController internalCreateController(
    Resources resources,
    DeferredReleaser deferredReleaser,
    DrawableFactory animatedDrawableFactory,
    Executor uiThreadExecutor,
    MemoryCache<CacheKey, CloseableImage> memoryCache,
    @Nullable ImmutableList<DrawableFactory> globalDrawableFactories,
    @Nullable ImmutableList<DrawableFactory> customDrawableFactories,
    Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
    String id,
    CacheKey cacheKey,
    Object callerContext) {
  PipelineDraweeController controller = new PipelineDraweeController(
      resources,
      deferredReleaser,
      animatedDrawableFactory,
      uiThreadExecutor,
      memoryCache,
      dataSourceSupplier,
      id,
      cacheKey,
      callerContext,
      globalDrawableFactories);
  controller.setCustomDrawableFactories(customDrawableFactories);
  return controller;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:PipelineDraweeControllerFactory.java

示例4: PipelineDraweeController

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
public PipelineDraweeController(
        Resources resources,
        DeferredReleaser deferredReleaser,
        DrawableFactory animatedDrawableFactory,
        Executor uiThreadExecutor,
        MemoryCache<CacheKey, CloseableImage> memoryCache,
        Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
        String id,
        CacheKey cacheKey,
        Object callerContext) {
  this(
      resources,
      deferredReleaser,
      animatedDrawableFactory,
      uiThreadExecutor,
      memoryCache,
      dataSourceSupplier,
      id,
      cacheKey,
      callerContext,
      null);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:PipelineDraweeController.java

示例5: ExperimentalBitmapAnimationDrawableFactory

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
public ExperimentalBitmapAnimationDrawableFactory(
    AnimatedDrawableBackendProvider animatedDrawableBackendProvider,
    ScheduledExecutorService scheduledExecutorServiceForUiThread,
    ExecutorService executorServiceForFramePreparing,
    MonotonicClock monotonicClock,
    PlatformBitmapFactory platformBitmapFactory,
    CountingMemoryCache<CacheKey, CloseableImage> backingCache,
    Supplier<Integer> cachingStrategySupplier,
    Supplier<Integer> numberOfFramesToPrepareSupplier) {
  mAnimatedDrawableBackendProvider = animatedDrawableBackendProvider;
  mScheduledExecutorServiceForUiThread = scheduledExecutorServiceForUiThread;
  mExecutorServiceForFramePreparing = executorServiceForFramePreparing;
  mMonotonicClock = monotonicClock;
  mPlatformBitmapFactory = platformBitmapFactory;
  mBackingCache = backingCache;
  mCachingStrategySupplier = cachingStrategySupplier;
  mNumberOfFramesToPrepareSupplier = numberOfFramesToPrepareSupplier;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:ExperimentalBitmapAnimationDrawableFactory.java

示例6: setUp

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
public void setUp() {
  mSrc1 = mock(DataSource.class);
  mSrc2 = mock(DataSource.class);
  mSrc3 = mock(DataSource.class);
  mDataSourceSupplier1 = mock(Supplier.class);
  mDataSourceSupplier2 = mock(Supplier.class);
  mDataSourceSupplier3 = mock(Supplier.class);
  when(mDataSourceSupplier1.get()).thenReturn(mSrc1);
  when(mDataSourceSupplier2.get()).thenReturn(mSrc2);
  when(mDataSourceSupplier3.get()).thenReturn(mSrc3);
  mDataSubscriber = mock(DataSubscriber.class);
  mExecutor = CallerThreadExecutor.getInstance();
  mInOrder = inOrder(
      mSrc1,
      mSrc2,
      mSrc3,
      mDataSourceSupplier1,
      mDataSourceSupplier2,
      mDataSourceSupplier3,
      mDataSubscriber);
  mSuppliers = Arrays.asList(
      mDataSourceSupplier1,
      mDataSourceSupplier2,
      mDataSourceSupplier3);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:DataSourceTestUtils.java

示例7: CountingMemoryCache

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
public CountingMemoryCache(
    ValueDescriptor<V> valueDescriptor,
    CacheTrimStrategy cacheTrimStrategy,
    Supplier<MemoryCacheParams> memoryCacheParamsSupplier,
    PlatformBitmapFactory platformBitmapFactory,
    boolean isExternalCreatedBitmapLogEnabled) {
  mValueDescriptor = valueDescriptor;
  mExclusiveEntries = new CountingLruMap<>(wrapValueDescriptor(valueDescriptor));
  mCachedEntries = new CountingLruMap<>(wrapValueDescriptor(valueDescriptor));
  mCacheTrimStrategy = cacheTrimStrategy;
  mMemoryCacheParamsSupplier = memoryCacheParamsSupplier;
  mMemoryCacheParams = mMemoryCacheParamsSupplier.get();
  mLastCacheParamsCheck = SystemClock.uptimeMillis();

  if (isExternalCreatedBitmapLogEnabled) {
    platformBitmapFactory.setCreationListener(
        new PlatformBitmapFactory.BitmapCreationObserver() {
          @Override
          public void onBitmapCreated(
              Bitmap bitmap,
              Object callerContext) {
            mOtherEntries.put(bitmap, callerContext);
          }
        });
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:CountingMemoryCache.java

示例8: DecodeProducer

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
public DecodeProducer(
    final ByteArrayPool byteArrayPool,
    final Executor executor,
    final ImageDecoder imageDecoder,
    final ProgressiveJpegConfig progressiveJpegConfig,
    final boolean downsampleEnabled,
    final boolean downsampleEnabledForNetwork,
    final boolean decodeCancellationEnabled,
    final Producer<EncodedImage> inputProducer,
    final Supplier<Boolean> experimentalSmartResizingEnabled) {
  mByteArrayPool = Preconditions.checkNotNull(byteArrayPool);
  mExecutor = Preconditions.checkNotNull(executor);
  mImageDecoder = Preconditions.checkNotNull(imageDecoder);
  mProgressiveJpegConfig = Preconditions.checkNotNull(progressiveJpegConfig);
  mDownsampleEnabled = downsampleEnabled;
  mDownsampleEnabledForNetwork = downsampleEnabledForNetwork;
  mInputProducer = Preconditions.checkNotNull(inputProducer);
  mDecodeCancellationEnabled = decodeCancellationEnabled;
  mExperimentalSmartResizingEnabled = experimentalSmartResizingEnabled;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:DecodeProducer.java

示例9: createProducerFactory

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
ProducerFactory createProducerFactory(
Context context,
ByteArrayPool byteArrayPool,
ImageDecoder imageDecoder,
ProgressiveJpegConfig progressiveJpegConfig,
boolean downsampleEnabled,
boolean resizeAndRotateEnabledForNetwork,
boolean decodeCancellationEnabled,
Supplier<Boolean> experimentalSmartResizingEnabled,
ExecutorSupplier executorSupplier,
PooledByteBufferFactory pooledByteBufferFactory,
MemoryCache<CacheKey, CloseableImage> bitmapMemoryCache,
MemoryCache<CacheKey, PooledByteBuffer> encodedMemoryCache,
BufferedDiskCache defaultBufferedDiskCache,
BufferedDiskCache smallImageBufferedDiskCache,
MediaVariationsIndex mediaVariationsIndex,
CacheKeyFactory cacheKeyFactory,
PlatformBitmapFactory platformBitmapFactory,
int bitmapPrepareToDrawMinSizeBytes,
int bitmapPrepareToDrawMaxSizeBytes,
boolean bitmapPrepareToDrawForPrefetch);
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:ImagePipelineExperiments.java

示例10: ImagePipeline

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
public ImagePipeline(
    ProducerSequenceFactory producerSequenceFactory,
    Set<RequestListener> requestListeners,
    Supplier<Boolean> isPrefetchEnabledSupplier,
    MemoryCache<CacheKey, CloseableImage> bitmapMemoryCache,
    MemoryCache<CacheKey, PooledByteBuffer> encodedMemoryCache,
    BufferedDiskCache mainBufferedDiskCache,
    BufferedDiskCache smallImageBufferedDiskCache,
    CacheKeyFactory cacheKeyFactory,
    ThreadHandoffProducerQueue threadHandoffProducerQueue,
    Supplier<Boolean> suppressBitmapPrefetchingSupplier) {
  mIdCounter = new AtomicLong();
  mProducerSequenceFactory = producerSequenceFactory;
  mRequestListener = new ForwardingRequestListener(requestListeners);
  mIsPrefetchEnabledSupplier = isPrefetchEnabledSupplier;
  mBitmapMemoryCache = bitmapMemoryCache;
  mEncodedMemoryCache = encodedMemoryCache;
  mMainBufferedDiskCache = mainBufferedDiskCache;
  mSmallImageBufferedDiskCache = smallImageBufferedDiskCache;
  mCacheKeyFactory = cacheKeyFactory;
  mThreadHandoffProducerQueue = threadHandoffProducerQueue;
  mSuppressBitmapPrefetchingSupplier = suppressBitmapPrefetchingSupplier;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:ImagePipeline.java

示例11: getDataSourceSupplier

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
/**
 * Returns a DataSource supplier that will on get submit the request for execution and return a
 * DataSource representing the pending results of the task.
 *
 * @param imageRequest the request to submit (what to execute).
 * @param callerContext the caller context of the caller of data source supplier
 * @param requestLevel which level to look down until for the image
 * @return a DataSource representing pending results and completion of the request
 */
public Supplier<DataSource<CloseableReference<CloseableImage>>> getDataSourceSupplier(
    final ImageRequest imageRequest,
    final Object callerContext,
    final ImageRequest.RequestLevel requestLevel) {
  return new Supplier<DataSource<CloseableReference<CloseableImage>>>() {
    @Override
    public DataSource<CloseableReference<CloseableImage>> get() {
      return fetchDecodedImage(imageRequest, callerContext, requestLevel);
    }

    @Override
    public String toString() {
      return Objects.toStringHelper(this)
          .add("uri", imageRequest.getSourceUri())
          .toString();
    }
  };
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:ImagePipeline.java

示例12: getEncodedImageDataSourceSupplier

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
/**
 * Returns a DataSource supplier that will on get submit the request for execution and return a
 * DataSource representing the pending results of the task.
 *
 * @param imageRequest the request to submit (what to execute).
 * @return a DataSource representing pending results and completion of the request
 */
public Supplier<DataSource<CloseableReference<PooledByteBuffer>>>
getEncodedImageDataSourceSupplier(
    final ImageRequest imageRequest,
    final Object callerContext) {
  return new Supplier<DataSource<CloseableReference<PooledByteBuffer>>>() {
    @Override
    public DataSource<CloseableReference<PooledByteBuffer>> get() {
      return fetchEncodedImage(imageRequest, callerContext);
    }

    @Override
    public String toString() {
      return Objects.toStringHelper(this)
          .add("uri", imageRequest.getSourceUri())
          .toString();
    }
  };
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:ImagePipeline.java

示例13: testGetBitmapCacheGetSupplier

import com.facebook.common.internal.Supplier; //导入依赖的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

示例14: testGetFullFetchSupplier

import com.facebook.common.internal.Supplier; //导入依赖的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

示例15: getFirstAvailableDataSourceSupplier

import com.facebook.common.internal.Supplier; //导入依赖的package包/类
protected Supplier<DataSource<IMAGE>> getFirstAvailableDataSourceSupplier(
    REQUEST[] imageRequests,
    boolean tryBitmapCacheOnlyFirst) {
  List<Supplier<DataSource<IMAGE>>> suppliers = new ArrayList<>(imageRequests.length * 2);
  if (tryBitmapCacheOnlyFirst) {
    // we first add bitmap-cache-only suppliers, then the full-fetch ones
    for (int i = 0; i < imageRequests.length; i++) {
      suppliers.add(
          getDataSourceSupplierForRequest(imageRequests[i], CacheLevel.BITMAP_MEMORY_CACHE));
    }
  }
  for (int i = 0; i < imageRequests.length; i++) {
    suppliers.add(getDataSourceSupplierForRequest(imageRequests[i]));
  }
  return FirstAvailableDataSourceSupplier.create(suppliers);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:AbstractDraweeControllerBuilder.java


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