use of com.facebook.common.executors.DefaultSerialExecutorService in project fresco by facebook.
the class AnimatedFactoryV2Impl method createDrawableFactory.
private ExperimentalBitmapAnimationDrawableFactory createDrawableFactory() {
Supplier<Integer> cachingStrategySupplier = new Supplier<Integer>() {
@Override
public Integer get() {
return ExperimentalBitmapAnimationDrawableFactory.CACHING_STRATEGY_FRESCO_CACHE_NO_REUSING;
}
};
final SerialExecutorService serialExecutorServiceForFramePreparing = mSerialExecutorService == null ? new DefaultSerialExecutorService(mExecutorSupplier.forDecode()) : mSerialExecutorService;
Supplier<Integer> numberOfFramesToPrepareSupplier = new Supplier<Integer>() {
@Override
public Integer get() {
return NUMBER_OF_FRAMES_TO_PREPARE;
}
};
final Supplier<Boolean> useDeepEquals = Suppliers.BOOLEAN_FALSE;
return new ExperimentalBitmapAnimationDrawableFactory(getAnimatedDrawableBackendProvider(), UiThreadImmediateExecutorService.getInstance(), serialExecutorServiceForFramePreparing, RealtimeSinceBootClock.get(), mPlatformBitmapFactory, mBackingCache, cachingStrategySupplier, numberOfFramesToPrepareSupplier, useDeepEquals);
}
use of com.facebook.common.executors.DefaultSerialExecutorService in project fresco by facebook.
the class ExampleBitmapAnimationFactory method createColorBitmapAnimationBackend.
public static BitmapAnimationBackend createColorBitmapAnimationBackend(final int[] colors, final int animationDurationMs, final BitmapFrameCache bitmapFrameCache) {
final PlatformBitmapFactory platformBitmapFactory = Fresco.getImagePipelineFactory().getPlatformBitmapFactory();
final BitmapFrameRenderer bitmapFrameRenderer = new ColorAndFrameNumberRenderer(colors);
final AnimationInformation animationInformation = new ColorListAnimationInformation(colors, animationDurationMs);
final ExecutorService executorServiceForFramePreparer = new DefaultSerialExecutorService(new DefaultExecutorSupplier(1).forDecode());
final BitmapFramePreparationStrategy framePreparationStrategy = new FixedNumberBitmapFramePreparationStrategy(NUMBER_OF_FRAMES_TO_PREPARE);
final BitmapFramePreparer bitmapFramePreparer = new DefaultBitmapFramePreparer(platformBitmapFactory, bitmapFrameRenderer, Bitmap.Config.ARGB_8888, executorServiceForFramePreparer);
BitmapAnimationBackend bitmapAnimationBackend = new BitmapAnimationBackend(platformBitmapFactory, bitmapFrameCache, animationInformation, bitmapFrameRenderer, framePreparationStrategy, bitmapFramePreparer);
bitmapAnimationBackend.setFrameListener(new DebugBitmapAnimationFrameListener());
return bitmapAnimationBackend;
}
use of com.facebook.common.executors.DefaultSerialExecutorService in project fresco by facebook.
the class AnimatedFactoryImpl method getAnimatedDrawableFactory.
@Override
public AnimatedDrawableFactory getAnimatedDrawableFactory(Context context) {
if (mAnimatedDrawableFactory == null) {
SerialExecutorService serialExecutorService = new DefaultSerialExecutorService(mExecutorSupplier.forDecode());
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
mAnimatedDrawableFactory = buildAnimatedDrawableFactory(serialExecutorService, activityManager, getAnimatedDrawableUtil(), getAnimatedDrawableBackendProvider(), UiThreadImmediateExecutorService.getInstance(), RealtimeSinceBootClock.get(), context.getResources());
}
return mAnimatedDrawableFactory;
}
Aggregations