Java 类com.facebook.common.executors.UiThreadImmediateExecutorService 实例源码

项目:RNLearn_Project1    文件:PipelineRequestHelper.java   
void attach(BitmapUpdateListener listener) {
  mBitmapUpdateListener = listener;

  mAttachCounter++;
  if (mAttachCounter != 1) {
    // this is a secondary attach, ignore it, only updating Bitmap boundaries if needed.
    Bitmap bitmap = getBitmap();
    if (bitmap != null) {
      listener.onSecondaryAttach(bitmap);
    }
    return;
  }

  listener.onImageLoadEvent(ImageLoadEvent.ON_LOAD_START);

  Assertions.assertCondition(mDataSource == null);
  Assertions.assertCondition(mImageRef == null);

  // Submit the request
  ImagePipeline imagePipeline = ImagePipelineFactory.getInstance().getImagePipeline();
  mDataSource = imagePipeline.fetchDecodedImage(mImageRequest, RCTImageView.getCallerContext());
  mDataSource.subscribe(this, UiThreadImmediateExecutorService.getInstance());
}
项目:RNLearn_Project1    文件:PipelineRequestHelper.java   
void attach(BitmapUpdateListener listener) {
  mBitmapUpdateListener = listener;

  mAttachCounter++;
  if (mAttachCounter != 1) {
    // this is a secondary attach, ignore it, only updating Bitmap boundaries if needed.
    Bitmap bitmap = getBitmap();
    if (bitmap != null) {
      listener.onSecondaryAttach(bitmap);
    }
    return;
  }

  listener.onImageLoadEvent(ImageLoadEvent.ON_LOAD_START);

  Assertions.assertCondition(mDataSource == null);
  Assertions.assertCondition(mImageRef == null);

  // Submit the request
  ImagePipeline imagePipeline = ImagePipelineFactory.getInstance().getImagePipeline();
  mDataSource = imagePipeline.fetchDecodedImage(mImageRequest, RCTImageView.getCallerContext());
  mDataSource.subscribe(this, UiThreadImmediateExecutorService.getInstance());
}
项目:GitHub    文件:PipelineDraweeControllerBuilderSupplier.java   
public PipelineDraweeControllerBuilderSupplier(
    Context context,
    ImagePipelineFactory imagePipelineFactory,
    Set<ControllerListener> boundControllerListeners,
    @Nullable DraweeConfig draweeConfig) {
  mContext = context;
  mImagePipeline = imagePipelineFactory.getImagePipeline();

  if (draweeConfig != null && draweeConfig.getPipelineDraweeControllerFactory() != null) {
    mPipelineDraweeControllerFactory = draweeConfig.getPipelineDraweeControllerFactory();
  } else {
    mPipelineDraweeControllerFactory = new PipelineDraweeControllerFactory();
  }
  mPipelineDraweeControllerFactory.init(
      context.getResources(),
      DeferredReleaser.getInstance(),
      imagePipelineFactory.getAnimatedDrawableFactory(context),
      UiThreadImmediateExecutorService.getInstance(),
      mImagePipeline.getBitmapMemoryCache(),
      draweeConfig != null
          ? draweeConfig.getCustomDrawableFactories()
          : null,
      draweeConfig != null
          ? draweeConfig.getDebugOverlayEnabledSupplier()
          : null);
  mBoundControllerListeners = boundControllerListeners;
}
项目:GitHub    文件:VolleyDraweeControllerBuilderSupplier.java   
public VolleyDraweeControllerBuilderSupplier(
    Context context,
    ImageLoader imageLoader,
    Set<ControllerListener> boundControllerListeners) {
  mContext = context;
  mImageLoader = imageLoader;
  mVolleyDraweeControllerFactory = new VolleyDraweeControllerFactory(
      context.getResources(),
      DeferredReleaser.getInstance(),
      UiThreadImmediateExecutorService.getInstance());
  mBoundControllerListeners = boundControllerListeners;
}
项目:GitHub    文件:AnimatedFactoryV2Impl.java   
private ExperimentalBitmapAnimationDrawableFactory createDrawableFactory() {
  Supplier<Integer> cachingStrategySupplier = new Supplier<Integer>() {
    @Override
    public Integer get() {
      return ExperimentalBitmapAnimationDrawableFactory.CACHING_STRATEGY_FRESCO_CACHE_NO_REUSING;
    }
  };

  final SerialExecutorService serialExecutorServiceForFramePreparing =
      new DefaultSerialExecutorService(mExecutorSupplier.forDecode());

  Supplier<Integer> numberOfFramesToPrepareSupplier = new Supplier<Integer>() {
    @Override
    public Integer get() {
      return NUMBER_OF_FRAMES_TO_PREPARE;
    }
  };

  return new ExperimentalBitmapAnimationDrawableFactory(
      getAnimatedDrawableBackendProvider(),
      UiThreadImmediateExecutorService.getInstance(),
      serialExecutorServiceForFramePreparing,
      RealtimeSinceBootClock.get(),
      mPlatformBitmapFactory,
      mBackingCache,
      cachingStrategySupplier,
      numberOfFramesToPrepareSupplier);
}
项目:GitHub    文件:AnimationBackendUtils.java   
/**
 * Wraps the given animation backend with an activity check.
 * When no frame has been drawn for more than 2 seconds, an inactivity toast message will
 * be displayed.
 *
 * @param context the context to be used for displaying the toast message
 * @param animationBackend the backend to wrap with the inactivity check
 * @return the wrapped backend to use
 */
public static AnimationBackend wrapAnimationBackendWithInactivityCheck(
    final Context context,
    final AnimationBackend animationBackend) {
  AnimationBackendDelegateWithInactivityCheck.InactivityListener inactivityListener =
      new AnimationBackendDelegateWithInactivityCheck.InactivityListener() {
        @Override
        public void onInactive() {
          // Forward the inactive callback to the backend if needed
          if (animationBackend instanceof
              AnimationBackendDelegateWithInactivityCheck.InactivityListener) {
            ((AnimationBackendDelegateWithInactivityCheck.InactivityListener) animationBackend)
                .onInactive();
          }
          Toast.makeText(
              context,
              "Animation backend inactive.",
              Toast.LENGTH_SHORT)
              .show();
        }
      };
  return createForBackend(
      animationBackend,
      inactivityListener,
      RealtimeSinceBootClock.get(),
      UiThreadImmediateExecutorService.getInstance());
}
项目:fresco    文件:PipelineDraweeControllerBuilderSupplier.java   
public PipelineDraweeControllerBuilderSupplier(
    Context context,
    ImagePipelineFactory imagePipelineFactory,
    Set<ControllerListener> boundControllerListeners,
    @Nullable DraweeConfig draweeConfig) {
  mContext = context;
  mImagePipeline = imagePipelineFactory.getImagePipeline();

  if (draweeConfig != null && draweeConfig.getPipelineDraweeControllerFactory() != null) {
    mPipelineDraweeControllerFactory = draweeConfig.getPipelineDraweeControllerFactory();
  } else {
    mPipelineDraweeControllerFactory = new PipelineDraweeControllerFactory();
  }
  mPipelineDraweeControllerFactory.init(
      context.getResources(),
      DeferredReleaser.getInstance(),
      imagePipelineFactory.getAnimatedDrawableFactory(context),
      UiThreadImmediateExecutorService.getInstance(),
      mImagePipeline.getBitmapMemoryCache(),
      draweeConfig != null
          ? draweeConfig.getCustomDrawableFactories()
          : null,
      draweeConfig != null
          ? draweeConfig.getDebugOverlayEnabledSupplier()
          : null);
  mBoundControllerListeners = boundControllerListeners;
}
项目:fresco    文件:VolleyDraweeControllerBuilderSupplier.java   
public VolleyDraweeControllerBuilderSupplier(
    Context context,
    ImageLoader imageLoader,
    Set<ControllerListener> boundControllerListeners) {
  mContext = context;
  mImageLoader = imageLoader;
  mVolleyDraweeControllerFactory = new VolleyDraweeControllerFactory(
      context.getResources(),
      DeferredReleaser.getInstance(),
      UiThreadImmediateExecutorService.getInstance());
  mBoundControllerListeners = boundControllerListeners;
}
项目:fresco    文件:AnimatedFactoryV2Impl.java   
private ExperimentalBitmapAnimationDrawableFactory createDrawableFactory() {
  Supplier<Integer> cachingStrategySupplier = new Supplier<Integer>() {
    @Override
    public Integer get() {
      return ExperimentalBitmapAnimationDrawableFactory.CACHING_STRATEGY_FRESCO_CACHE_NO_REUSING;
    }
  };

  final SerialExecutorService serialExecutorServiceForFramePreparing =
      new DefaultSerialExecutorService(mExecutorSupplier.forDecode());

  Supplier<Integer> numberOfFramesToPrepareSupplier = new Supplier<Integer>() {
    @Override
    public Integer get() {
      return NUMBER_OF_FRAMES_TO_PREPARE;
    }
  };

  return new ExperimentalBitmapAnimationDrawableFactory(
      getAnimatedDrawableBackendProvider(),
      UiThreadImmediateExecutorService.getInstance(),
      serialExecutorServiceForFramePreparing,
      RealtimeSinceBootClock.get(),
      mPlatformBitmapFactory,
      mBackingCache,
      cachingStrategySupplier,
      numberOfFramesToPrepareSupplier);
}
项目:fresco    文件:AnimationBackendUtils.java   
/**
 * Wraps the given animation backend with an activity check.
 * When no frame has been drawn for more than 2 seconds, an inactivity toast message will
 * be displayed.
 *
 * @param context the context to be used for displaying the toast message
 * @param animationBackend the backend to wrap with the inactivity check
 * @return the wrapped backend to use
 */
public static AnimationBackend wrapAnimationBackendWithInactivityCheck(
    final Context context,
    final AnimationBackend animationBackend) {
  AnimationBackendDelegateWithInactivityCheck.InactivityListener inactivityListener =
      new AnimationBackendDelegateWithInactivityCheck.InactivityListener() {
        @Override
        public void onInactive() {
          // Forward the inactive callback to the backend if needed
          if (animationBackend instanceof
              AnimationBackendDelegateWithInactivityCheck.InactivityListener) {
            ((AnimationBackendDelegateWithInactivityCheck.InactivityListener) animationBackend)
                .onInactive();
          }
          Toast.makeText(
              context,
              "Animation backend inactive.",
              Toast.LENGTH_SHORT)
              .show();
        }
      };
  return createForBackend(
      animationBackend,
      inactivityListener,
      RealtimeSinceBootClock.get(),
      UiThreadImmediateExecutorService.getInstance());
}
项目:apps-android-wikipedia    文件:ImagePipelineBitmapGetter.java   
public void get() {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imageUrl))
            .build();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>> dataSource
            = imagePipeline.fetchDecodedImage(request, WikipediaApp.getInstance());
    dataSource.subscribe(new BitmapDataSubscriber(), UiThreadImmediateExecutorService.getInstance());
}