ExperimentalBitmapAnimationDrawableFactory.smali
.class public Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;
.super Ljava/lang/Object;
.source "ExperimentalBitmapAnimationDrawableFactory.java"
# interfaces
.implements Lcom/facebook/imagepipeline/drawable/DrawableFactory;
# static fields
.field public static final CACHING_STRATEGY_FRESCO_CACHE:I = 0x1
.field public static final CACHING_STRATEGY_FRESCO_CACHE_NO_REUSING:I = 0x2
.field public static final CACHING_STRATEGY_KEEP_LAST_CACHE:I = 0x3
.field public static final CACHING_STRATEGY_NO_CACHE:I
# instance fields
.field private final mAnimatedDrawableBackendProvider:Lcom/facebook/imagepipeline/animated/impl/AnimatedDrawableBackendProvider;
.field private final mBackingCache:Lcom/facebook/imagepipeline/cache/CountingMemoryCache;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache<",
"Lcom/facebook/cache/common/CacheKey;",
"Lcom/facebook/imagepipeline/image/CloseableImage;",
">;"
}
.end annotation
.end field
.field private final mCachingStrategySupplier:Lcom/facebook/common/internal/Supplier;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/facebook/common/internal/Supplier<",
"Ljava/lang/Integer;",
">;"
}
.end annotation
.end field
.field private final mExecutorServiceForFramePreparing:Ljava/util/concurrent/ExecutorService;
.field private final mMonotonicClock:Lcom/facebook/common/time/MonotonicClock;
.field private final mNumberOfFramesToPrepareSupplier:Lcom/facebook/common/internal/Supplier;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/facebook/common/internal/Supplier<",
"Ljava/lang/Integer;",
">;"
}
.end annotation
.end field
.field private final mPlatformBitmapFactory:Lcom/facebook/imagepipeline/bitmaps/PlatformBitmapFactory;
.field private final mScheduledExecutorServiceForUiThread:Ljava/util/concurrent/ScheduledExecutorService;
.field private final mUseDeepEqualsForCacheKey:Lcom/facebook/common/internal/Supplier;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/facebook/common/internal/Supplier<",
"Ljava/lang/Boolean;",
">;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>(Lcom/facebook/imagepipeline/animated/impl/AnimatedDrawableBackendProvider;Ljava/util/concurrent/ScheduledExecutorService;Ljava/util/concurrent/ExecutorService;Lcom/facebook/common/time/MonotonicClock;Lcom/facebook/imagepipeline/bitmaps/PlatformBitmapFactory;Lcom/facebook/imagepipeline/cache/CountingMemoryCache;Lcom/facebook/common/internal/Supplier;Lcom/facebook/common/internal/Supplier;Lcom/facebook/common/internal/Supplier;)V
.registers 10
.annotation system Ldalvik/annotation/MethodParameters;
accessFlags = {
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0
}
names = {
"animatedDrawableBackendProvider",
"scheduledExecutorServiceForUiThread",
"executorServiceForFramePreparing",
"monotonicClock",
"platformBitmapFactory",
"backingCache",
"cachingStrategySupplier",
"numberOfFramesToPrepareSupplier",
"useDeepEqualsForCacheKey"
}
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/animated/impl/AnimatedDrawableBackendProvider;",
"Ljava/util/concurrent/ScheduledExecutorService;",
"Ljava/util/concurrent/ExecutorService;",
"Lcom/facebook/common/time/MonotonicClock;",
"Lcom/facebook/imagepipeline/bitmaps/PlatformBitmapFactory;",
"Lcom/facebook/imagepipeline/cache/CountingMemoryCache<",
"Lcom/facebook/cache/common/CacheKey;",
"Lcom/facebook/imagepipeline/image/CloseableImage;",
">;",
"Lcom/facebook/common/internal/Supplier<",
"Ljava/lang/Integer;",
">;",
"Lcom/facebook/common/internal/Supplier<",
"Ljava/lang/Integer;",
">;",
"Lcom/facebook/common/internal/Supplier<",
"Ljava/lang/Boolean;",
">;)V"
}
.end annotation
.line 75
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 76
iput-object p1, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mAnimatedDrawableBackendProvider:Lcom/facebook/imagepipeline/animated/impl/AnimatedDrawableBackendProvider;
.line 77
iput-object p2, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mScheduledExecutorServiceForUiThread:Ljava/util/concurrent/ScheduledExecutorService;
.line 78
iput-object p3, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mExecutorServiceForFramePreparing:Ljava/util/concurrent/ExecutorService;
.line 79
iput-object p4, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mMonotonicClock:Lcom/facebook/common/time/MonotonicClock;
.line 80
iput-object p5, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mPlatformBitmapFactory:Lcom/facebook/imagepipeline/bitmaps/PlatformBitmapFactory;
.line 81
iput-object p6, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mBackingCache:Lcom/facebook/imagepipeline/cache/CountingMemoryCache;
.line 82
iput-object p7, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mCachingStrategySupplier:Lcom/facebook/common/internal/Supplier;
.line 83
iput-object p8, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mNumberOfFramesToPrepareSupplier:Lcom/facebook/common/internal/Supplier;
.line 84
iput-object p9, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mUseDeepEqualsForCacheKey:Lcom/facebook/common/internal/Supplier;
return-void
.end method
.method private createAnimatedDrawableBackend(Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;)Lcom/facebook/imagepipeline/animated/base/AnimatedDrawableBackend;
.registers 6
.annotation system Ldalvik/annotation/MethodParameters;
accessFlags = {
0x0
}
names = {
"animatedImageResult"
}
.end annotation
.line 144
invoke-virtual {p1}, Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;->getImage()Lcom/facebook/imagepipeline/animated/base/AnimatedImage;
move-result-object v0
.line 145
new-instance v1, Landroid/graphics/Rect;
invoke-interface {v0}, Lcom/facebook/imagepipeline/animated/base/AnimatedImage;->getWidth()I
move-result v2
invoke-interface {v0}, Lcom/facebook/imagepipeline/animated/base/AnimatedImage;->getHeight()I
move-result v0
const/4 v3, 0x0
invoke-direct {v1, v3, v3, v2, v0}, Landroid/graphics/Rect;-><init>(IIII)V
.line 146
iget-object v0, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mAnimatedDrawableBackendProvider:Lcom/facebook/imagepipeline/animated/impl/AnimatedDrawableBackendProvider;
invoke-interface {v0, p1, v1}, Lcom/facebook/imagepipeline/animated/impl/AnimatedDrawableBackendProvider;->get(Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;Landroid/graphics/Rect;)Lcom/facebook/imagepipeline/animated/base/AnimatedDrawableBackend;
move-result-object p1
return-object p1
.end method
.method private createAnimatedFrameCache(Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;)Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;
.registers 5
.annotation system Ldalvik/annotation/MethodParameters;
accessFlags = {
0x10
}
names = {
"animatedImageResult"
}
.end annotation
.line 165
new-instance v0, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;
new-instance v1, Lcom/facebook/fresco/animation/bitmap/cache/AnimationFrameCacheKey;
.line 166
invoke-virtual {p1}, Ljava/lang/Object;->hashCode()I
move-result p1
iget-object v2, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mUseDeepEqualsForCacheKey:Lcom/facebook/common/internal/Supplier;
invoke-interface {v2}, Lcom/facebook/common/internal/Supplier;->get()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/Boolean;
invoke-virtual {v2}, Ljava/lang/Boolean;->booleanValue()Z
move-result v2
invoke-direct {v1, p1, v2}, Lcom/facebook/fresco/animation/bitmap/cache/AnimationFrameCacheKey;-><init>(IZ)V
iget-object p1, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mBackingCache:Lcom/facebook/imagepipeline/cache/CountingMemoryCache;
invoke-direct {v0, v1, p1}, Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;-><init>(Lcom/facebook/cache/common/CacheKey;Lcom/facebook/imagepipeline/cache/CountingMemoryCache;)V
return-object v0
.end method
.method private createAnimationBackend(Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;Landroid/graphics/Bitmap$Config;)Lcom/facebook/fresco/animation/backend/AnimationBackend;
.registers 11
.param p2 # Landroid/graphics/Bitmap$Config;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.annotation system Ldalvik/annotation/MethodParameters;
accessFlags = {
0x0,
0x0
}
names = {
"animatedImageResult",
"animatedBitmapConig"
}
.end annotation
.line 105
invoke-direct {p0, p1}, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->createAnimatedDrawableBackend(Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;)Lcom/facebook/imagepipeline/animated/base/AnimatedDrawableBackend;
move-result-object v0
.line 107
invoke-direct {p0, p1}, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->createBitmapFrameCache(Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;)Lcom/facebook/fresco/animation/bitmap/BitmapFrameCache;
move-result-object v3
.line 108
new-instance v5, Lcom/facebook/fresco/animation/bitmap/wrapper/AnimatedDrawableBackendFrameRenderer;
invoke-direct {v5, v3, v0}, Lcom/facebook/fresco/animation/bitmap/wrapper/AnimatedDrawableBackendFrameRenderer;-><init>(Lcom/facebook/fresco/animation/bitmap/BitmapFrameCache;Lcom/facebook/imagepipeline/animated/base/AnimatedDrawableBackend;)V
.line 111
iget-object p1, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mNumberOfFramesToPrepareSupplier:Lcom/facebook/common/internal/Supplier;
invoke-interface {p1}, Lcom/facebook/common/internal/Supplier;->get()Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/lang/Integer;
invoke-virtual {p1}, Ljava/lang/Integer;->intValue()I
move-result p1
const/4 v1, 0x0
if-lez p1, :cond_28
.line 115
new-instance v1, Lcom/facebook/fresco/animation/bitmap/preparation/FixedNumberBitmapFramePreparationStrategy;
invoke-direct {v1, p1}, Lcom/facebook/fresco/animation/bitmap/preparation/FixedNumberBitmapFramePreparationStrategy;-><init>(I)V
.line 117
invoke-direct {p0, v5, p2}, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->createBitmapFramePreparer(Lcom/facebook/fresco/animation/bitmap/BitmapFrameRenderer;Landroid/graphics/Bitmap$Config;)Lcom/facebook/fresco/animation/bitmap/preparation/BitmapFramePreparer;
move-result-object p1
move-object v7, p1
move-object v6, v1
goto :goto_2a
:cond_28
move-object v6, v1
move-object v7, v6
.line 120
:goto_2a
new-instance p1, Lcom/facebook/fresco/animation/bitmap/BitmapAnimationBackend;
iget-object v2, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mPlatformBitmapFactory:Lcom/facebook/imagepipeline/bitmaps/PlatformBitmapFactory;
new-instance v4, Lcom/facebook/fresco/animation/bitmap/wrapper/AnimatedDrawableBackendAnimationInformation;
invoke-direct {v4, v0}, Lcom/facebook/fresco/animation/bitmap/wrapper/AnimatedDrawableBackendAnimationInformation;-><init>(Lcom/facebook/imagepipeline/animated/base/AnimatedDrawableBackend;)V
move-object v1, p1
invoke-direct/range {v1 .. v7}, Lcom/facebook/fresco/animation/bitmap/BitmapAnimationBackend;-><init>(Lcom/facebook/imagepipeline/bitmaps/PlatformBitmapFactory;Lcom/facebook/fresco/animation/bitmap/BitmapFrameCache;Lcom/facebook/fresco/animation/backend/AnimationInformation;Lcom/facebook/fresco/animation/bitmap/BitmapFrameRenderer;Lcom/facebook/fresco/animation/bitmap/preparation/BitmapFramePreparationStrategy;Lcom/facebook/fresco/animation/bitmap/preparation/BitmapFramePreparer;)V
.line 129
iget-object p2, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mMonotonicClock:Lcom/facebook/common/time/MonotonicClock;
iget-object v0, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mScheduledExecutorServiceForUiThread:Ljava/util/concurrent/ScheduledExecutorService;
invoke-static {p1, p2, v0}, Lcom/facebook/fresco/animation/backend/AnimationBackendDelegateWithInactivityCheck;->createForBackend(Lcom/facebook/fresco/animation/backend/AnimationBackend;Lcom/facebook/common/time/MonotonicClock;Ljava/util/concurrent/ScheduledExecutorService;)Lcom/facebook/fresco/animation/backend/AnimationBackendDelegate;
move-result-object p1
return-object p1
.end method
.method private createBitmapFrameCache(Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;)Lcom/facebook/fresco/animation/bitmap/BitmapFrameCache;
.registers 4
.annotation system Ldalvik/annotation/MethodParameters;
accessFlags = {
0x0
}
names = {
"animatedImageResult"
}
.end annotation
.line 150
iget-object v0, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mCachingStrategySupplier:Lcom/facebook/common/internal/Supplier;
invoke-interface {v0}, Lcom/facebook/common/internal/Supplier;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Integer;
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
move-result v0
const/4 v1, 0x1
if-eq v0, v1, :cond_2c
const/4 v1, 0x2
if-eq v0, v1, :cond_21
const/4 p1, 0x3
if-eq v0, p1, :cond_1b
.line 159
new-instance p1, Lcom/facebook/fresco/animation/bitmap/cache/NoOpCache;
invoke-direct {p1}, Lcom/facebook/fresco/animation/bitmap/cache/NoOpCache;-><init>()V
return-object p1
.line 156
:cond_1b
new-instance p1, Lcom/facebook/fresco/animation/bitmap/cache/KeepLastFrameCache;
invoke-direct {p1}, Lcom/facebook/fresco/animation/bitmap/cache/KeepLastFrameCache;-><init>()V
return-object p1
.line 154
:cond_21
new-instance v0, Lcom/facebook/fresco/animation/bitmap/cache/FrescoFrameCache;
invoke-direct {p0, p1}, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->createAnimatedFrameCache(Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;)Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;
move-result-object p1
const/4 v1, 0x0
invoke-direct {v0, p1, v1}, Lcom/facebook/fresco/animation/bitmap/cache/FrescoFrameCache;-><init>(Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;Z)V
return-object v0
.line 152
:cond_2c
new-instance v0, Lcom/facebook/fresco/animation/bitmap/cache/FrescoFrameCache;
invoke-direct {p0, p1}, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->createAnimatedFrameCache(Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;)Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;
move-result-object p1
invoke-direct {v0, p1, v1}, Lcom/facebook/fresco/animation/bitmap/cache/FrescoFrameCache;-><init>(Lcom/facebook/imagepipeline/animated/impl/AnimatedFrameCache;Z)V
return-object v0
.end method
.method private createBitmapFramePreparer(Lcom/facebook/fresco/animation/bitmap/BitmapFrameRenderer;Landroid/graphics/Bitmap$Config;)Lcom/facebook/fresco/animation/bitmap/preparation/BitmapFramePreparer;
.registers 6
.param p2 # Landroid/graphics/Bitmap$Config;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.annotation system Ldalvik/annotation/MethodParameters;
accessFlags = {
0x0,
0x0
}
names = {
"bitmapFrameRenderer",
"animatedBitmapConig"
}
.end annotation
.line 135
new-instance v0, Lcom/facebook/fresco/animation/bitmap/preparation/DefaultBitmapFramePreparer;
iget-object v1, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mPlatformBitmapFactory:Lcom/facebook/imagepipeline/bitmaps/PlatformBitmapFactory;
if-eqz p2, :cond_7
goto :goto_9
:cond_7
sget-object p2, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;
:goto_9
iget-object v2, p0, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->mExecutorServiceForFramePreparing:Ljava/util/concurrent/ExecutorService;
invoke-direct {v0, v1, p1, p2, v2}, Lcom/facebook/fresco/animation/bitmap/preparation/DefaultBitmapFramePreparer;-><init>(Lcom/facebook/imagepipeline/bitmaps/PlatformBitmapFactory;Lcom/facebook/fresco/animation/bitmap/BitmapFrameRenderer;Landroid/graphics/Bitmap$Config;Ljava/util/concurrent/ExecutorService;)V
return-object v0
.end method
# virtual methods
.method public bridge synthetic createDrawable(Lcom/facebook/imagepipeline/image/CloseableImage;)Landroid/graphics/drawable/Drawable;
.registers 2
.annotation system Ldalvik/annotation/MethodParameters;
accessFlags = {
0x1000
}
names = {
"image"
}
.end annotation
.line 48
invoke-virtual {p0, p1}, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->createDrawable(Lcom/facebook/imagepipeline/image/CloseableImage;)Lcom/facebook/fresco/animation/drawable/AnimatedDrawable2;
move-result-object p1
return-object p1
.end method
.method public createDrawable(Lcom/facebook/imagepipeline/image/CloseableImage;)Lcom/facebook/fresco/animation/drawable/AnimatedDrawable2;
.registers 4
.annotation system Ldalvik/annotation/MethodParameters;
accessFlags = {
0x0
}
names = {
"image"
}
.end annotation
.line 94
check-cast p1, Lcom/facebook/imagepipeline/image/CloseableAnimatedImage;
.line 95
invoke-virtual {p1}, Lcom/facebook/imagepipeline/image/CloseableAnimatedImage;->getImage()Lcom/facebook/imagepipeline/animated/base/AnimatedImage;
move-result-object v0
.line 96
new-instance v1, Lcom/facebook/fresco/animation/drawable/AnimatedDrawable2;
.line 98
invoke-virtual {p1}, Lcom/facebook/imagepipeline/image/CloseableAnimatedImage;->getImageResult()Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;
move-result-object p1
invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;
if-eqz v0, :cond_19
.line 99
invoke-interface {v0}, Lcom/facebook/imagepipeline/animated/base/AnimatedImage;->getAnimatedBitmapConfig()Landroid/graphics/Bitmap$Config;
move-result-object v0
goto :goto_1a
:cond_19
const/4 v0, 0x0
.line 97
:goto_1a
invoke-direct {p0, p1, v0}, Lcom/facebook/fresco/animation/factory/ExperimentalBitmapAnimationDrawableFactory;->createAnimationBackend(Lcom/facebook/imagepipeline/animated/base/AnimatedImageResult;Landroid/graphics/Bitmap$Config;)Lcom/facebook/fresco/animation/backend/AnimationBackend;
move-result-object p1
invoke-direct {v1, p1}, Lcom/facebook/fresco/animation/drawable/AnimatedDrawable2;-><init>(Lcom/facebook/fresco/animation/backend/AnimationBackend;)V
return-object v1
.end method
.method public supportsImageType(Lcom/facebook/imagepipeline/image/CloseableImage;)Z
.registers 2
.annotation system Ldalvik/annotation/MethodParameters;
accessFlags = {
0x0
}
names = {
"image"
}
.end annotation
.line 89
instance-of p1, p1, Lcom/facebook/imagepipeline/image/CloseableAnimatedImage;
return p1
.end method