Search in sources :

Example 1 with AnimatedDrawableCachingBackend

use of com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend in project fresco by facebook.

the class ExperimentalAnimationFactory method createAnimationBackend.

private AnimationBackend createAnimationBackend(AnimatedImageResult animatedImageResult) {
    // Create the animated drawable backend
    AnimatedImage animatedImage = animatedImageResult.getImage();
    Rect initialBounds = new Rect(0, 0, animatedImage.getWidth(), animatedImage.getHeight());
    AnimatedDrawableBackend animatedDrawableBackend = mAnimatedDrawableBackendProvider.get(animatedImageResult, initialBounds);
    // Add caching backend
    AnimatedDrawableCachingBackend animatedDrawableCachingBackend = mAnimatedDrawableCachingBackendProvider.get(animatedDrawableBackend, AnimatedDrawableOptions.DEFAULTS);
    AnimatedDrawableCachingBackendWrapper animatedDrawableCachingBackendWrapper = new AnimatedDrawableCachingBackendWrapper(animatedDrawableCachingBackend);
    // Add inactivity check
    return AnimationBackendDelegateWithInactivityCheck.createForBackend(animatedDrawableCachingBackendWrapper, mMonotonicClock, mScheduledExecutorServiceForUiThread);
}
Also used : AnimatedDrawableBackend(com.facebook.imagepipeline.animated.base.AnimatedDrawableBackend) Rect(android.graphics.Rect) AnimatedImage(com.facebook.imagepipeline.animated.base.AnimatedImage) CloseableAnimatedImage(com.facebook.imagepipeline.image.CloseableAnimatedImage) AnimatedDrawableCachingBackend(com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend) AnimatedDrawableCachingBackendWrapper(com.facebook.fresco.animation.wrapper.AnimatedDrawableCachingBackendWrapper)

Example 2 with AnimatedDrawableCachingBackend

use of com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend in project fresco by facebook.

the class AnimatedDrawableCachingBackendWrapper method setBounds.

@Override
public void setBounds(@Nullable Rect bounds) {
    if (bounds != null && bounds.equals(mBounds)) {
        return;
    }
    mBounds = bounds;
    AnimatedDrawableCachingBackend newBackend = mAnimatedDrawableCachingBackend.forNewBounds(bounds);
    if (newBackend != mAnimatedDrawableCachingBackend) {
        mAnimatedDrawableCachingBackend.dropCaches();
    }
    mAnimatedDrawableCachingBackend = newBackend;
    CloseableReference.closeSafely(mLastDrawnFrame);
    mLastDrawnFrame = null;
}
Also used : AnimatedDrawableCachingBackend(com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend)

Example 3 with AnimatedDrawableCachingBackend

use of com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend in project fresco by facebook.

the class AnimatedDrawableFactoryImpl method createAnimatedDrawable.

private AnimatedDrawable createAnimatedDrawable(AnimatedDrawableOptions options, AnimatedDrawableBackend animatedDrawableBackend) {
    DisplayMetrics displayMetrics = mResources.getDisplayMetrics();
    AnimatedDrawableDiagnostics animatedDrawableDiagnostics;
    AnimatedDrawableCachingBackend animatedDrawableCachingBackend = mAnimatedDrawableCachingBackendProvider.get(animatedDrawableBackend, options);
    if (options.enableDebugging) {
        animatedDrawableDiagnostics = new AnimatedDrawableDiagnosticsImpl(mAnimatedDrawableUtil, displayMetrics);
    } else {
        animatedDrawableDiagnostics = AnimatedDrawableDiagnosticsNoop.getInstance();
    }
    return new AnimatedDrawable(mScheduledExecutorServiceForUiThread, animatedDrawableCachingBackend, animatedDrawableDiagnostics, mMonotonicClock);
}
Also used : AnimatedDrawableDiagnosticsImpl(com.facebook.imagepipeline.animated.impl.AnimatedDrawableDiagnosticsImpl) AnimatedDrawableDiagnostics(com.facebook.imagepipeline.animated.base.AnimatedDrawableDiagnostics) DisplayMetrics(android.util.DisplayMetrics) AnimatedDrawableCachingBackend(com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend) AnimatedDrawable(com.facebook.imagepipeline.animated.base.AnimatedDrawable)

Example 4 with AnimatedDrawableCachingBackend

use of com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend in project fresco by facebook.

the class AnimatedDrawableFactoryImplSupport method createAnimatedDrawable.

private AnimatedDrawableSupport createAnimatedDrawable(AnimatedDrawableOptions options, AnimatedDrawableBackend animatedDrawableBackend) {
    DisplayMetrics displayMetrics = mResources.getDisplayMetrics();
    AnimatedDrawableDiagnostics animatedDrawableDiagnostics;
    AnimatedDrawableCachingBackend animatedDrawableCachingBackend = mAnimatedDrawableCachingBackendProvider.get(animatedDrawableBackend, options);
    if (options.enableDebugging) {
        animatedDrawableDiagnostics = new AnimatedDrawableDiagnosticsImpl(mAnimatedDrawableUtil, displayMetrics);
    } else {
        animatedDrawableDiagnostics = AnimatedDrawableDiagnosticsNoop.getInstance();
    }
    return new AnimatedDrawableSupport(mScheduledExecutorServiceForUiThread, animatedDrawableCachingBackend, animatedDrawableDiagnostics, mMonotonicClock);
}
Also used : AnimatedDrawableDiagnosticsImpl(com.facebook.imagepipeline.animated.impl.AnimatedDrawableDiagnosticsImpl) AnimatedDrawableDiagnostics(com.facebook.imagepipeline.animated.base.AnimatedDrawableDiagnostics) AnimatedDrawableSupport(com.facebook.imagepipeline.animated.base.AnimatedDrawableSupport) DisplayMetrics(android.util.DisplayMetrics) AnimatedDrawableCachingBackend(com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend)

Aggregations

AnimatedDrawableCachingBackend (com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend)4 DisplayMetrics (android.util.DisplayMetrics)2 AnimatedDrawableDiagnostics (com.facebook.imagepipeline.animated.base.AnimatedDrawableDiagnostics)2 AnimatedDrawableDiagnosticsImpl (com.facebook.imagepipeline.animated.impl.AnimatedDrawableDiagnosticsImpl)2 Rect (android.graphics.Rect)1 AnimatedDrawableCachingBackendWrapper (com.facebook.fresco.animation.wrapper.AnimatedDrawableCachingBackendWrapper)1 AnimatedDrawable (com.facebook.imagepipeline.animated.base.AnimatedDrawable)1 AnimatedDrawableBackend (com.facebook.imagepipeline.animated.base.AnimatedDrawableBackend)1 AnimatedDrawableSupport (com.facebook.imagepipeline.animated.base.AnimatedDrawableSupport)1 AnimatedImage (com.facebook.imagepipeline.animated.base.AnimatedImage)1 CloseableAnimatedImage (com.facebook.imagepipeline.image.CloseableAnimatedImage)1