本文整理汇总了Java中com.facebook.common.executors.UiThreadImmediateExecutorService类的典型用法代码示例。如果您正苦于以下问题:Java UiThreadImmediateExecutorService类的具体用法?Java UiThreadImmediateExecutorService怎么用?Java UiThreadImmediateExecutorService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UiThreadImmediateExecutorService类属于com.facebook.common.executors包,在下文中一共展示了UiThreadImmediateExecutorService类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attach
import com.facebook.common.executors.UiThreadImmediateExecutorService; //导入依赖的package包/类
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());
}
示例2: PipelineDraweeControllerBuilderSupplier
import com.facebook.common.executors.UiThreadImmediateExecutorService; //导入依赖的package包/类
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;
}
示例3: VolleyDraweeControllerBuilderSupplier
import com.facebook.common.executors.UiThreadImmediateExecutorService; //导入依赖的package包/类
public VolleyDraweeControllerBuilderSupplier(
Context context,
ImageLoader imageLoader,
Set<ControllerListener> boundControllerListeners) {
mContext = context;
mImageLoader = imageLoader;
mVolleyDraweeControllerFactory = new VolleyDraweeControllerFactory(
context.getResources(),
DeferredReleaser.getInstance(),
UiThreadImmediateExecutorService.getInstance());
mBoundControllerListeners = boundControllerListeners;
}
示例4: createDrawableFactory
import com.facebook.common.executors.UiThreadImmediateExecutorService; //导入依赖的package包/类
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);
}
示例5: wrapAnimationBackendWithInactivityCheck
import com.facebook.common.executors.UiThreadImmediateExecutorService; //导入依赖的package包/类
/**
* 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());
}
示例6: get
import com.facebook.common.executors.UiThreadImmediateExecutorService; //导入依赖的package包/类
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());
}