NativeImageHelper$1.smali

.class final Lcom/tradplus/ads/common/NativeImageHelper$1;
.super Ljava/lang/Object;

# interfaces
.implements Lcom/tradplus/ads/volley/toolbox/ImageLoader$ImageListener;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/tradplus/ads/common/NativeImageHelper;->preCacheImages(Landroid/content/Context;Ljava/util/List;Lcom/tradplus/ads/common/NativeImageHelper$ImageListener;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = null
.end annotation


# instance fields
.field final synthetic a:Ljava/util/concurrent/atomic/AtomicInteger;

.field final synthetic b:Ljava/util/concurrent/atomic/AtomicBoolean;

.field final synthetic c:Lcom/tradplus/ads/common/NativeImageHelper$ImageListener;


# direct methods
.method constructor <init>(Ljava/util/concurrent/atomic/AtomicInteger;Ljava/util/concurrent/atomic/AtomicBoolean;Lcom/tradplus/ads/common/NativeImageHelper$ImageListener;)V
    .registers 4

    iput-object p1, p0, Lcom/tradplus/ads/common/NativeImageHelper$1;->a:Ljava/util/concurrent/atomic/AtomicInteger;

    iput-object p2, p0, Lcom/tradplus/ads/common/NativeImageHelper$1;->b:Ljava/util/concurrent/atomic/AtomicBoolean;

    iput-object p3, p0, Lcom/tradplus/ads/common/NativeImageHelper$1;->c:Lcom/tradplus/ads/common/NativeImageHelper$ImageListener;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public onErrorResponse(Lcom/tradplus/ads/volley/VolleyError;)V
    .registers 3

    const-string v0, "Failed to download a native ads image:"

    invoke-static {v0, p1}, Lcom/tradplus/ads/common/util/LogUtil;->show(Ljava/lang/String;Ljava/lang/Object;)V

    iget-object p1, p0, Lcom/tradplus/ads/common/NativeImageHelper$1;->b:Ljava/util/concurrent/atomic/AtomicBoolean;

    const/4 v0, 0x1

    invoke-virtual {p1, v0}, Ljava/util/concurrent/atomic/AtomicBoolean;->getAndSet(Z)Z

    move-result p1

    iget-object v0, p0, Lcom/tradplus/ads/common/NativeImageHelper$1;->a:Ljava/util/concurrent/atomic/AtomicInteger;

    invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicInteger;->decrementAndGet()I

    if-nez p1, :cond_1a

    iget-object p1, p0, Lcom/tradplus/ads/common/NativeImageHelper$1;->c:Lcom/tradplus/ads/common/NativeImageHelper$ImageListener;

    sget-object v0, Lcom/tradplus/ads/mobileads/TradPlusErrorCode;->IMAGE_DOWNLOAD_FAILURE:Lcom/tradplus/ads/mobileads/TradPlusErrorCode;

    invoke-interface {p1, v0}, Lcom/tradplus/ads/common/NativeImageHelper$ImageListener;->onImagesFailedToCache(Lcom/tradplus/ads/mobileads/TradPlusErrorCode;)V

    :cond_1a
    return-void
.end method

.method public onResponse(Lcom/tradplus/ads/volley/toolbox/ImageLoader$ImageContainer;Z)V
    .registers 3

    invoke-virtual {p1}, Lcom/tradplus/ads/volley/toolbox/ImageLoader$ImageContainer;->getBitmap()Landroid/graphics/Bitmap;

    move-result-object p1

    if-eqz p1, :cond_1b

    iget-object p1, p0, Lcom/tradplus/ads/common/NativeImageHelper$1;->a:Ljava/util/concurrent/atomic/AtomicInteger;

    invoke-virtual {p1}, Ljava/util/concurrent/atomic/AtomicInteger;->decrementAndGet()I

    move-result p1

    if-nez p1, :cond_1b

    iget-object p1, p0, Lcom/tradplus/ads/common/NativeImageHelper$1;->b:Ljava/util/concurrent/atomic/AtomicBoolean;

    invoke-virtual {p1}, Ljava/util/concurrent/atomic/AtomicBoolean;->get()Z

    move-result p1

    if-nez p1, :cond_1b

    iget-object p1, p0, Lcom/tradplus/ads/common/NativeImageHelper$1;->c:Lcom/tradplus/ads/common/NativeImageHelper$ImageListener;

    invoke-interface {p1}, Lcom/tradplus/ads/common/NativeImageHelper$ImageListener;->onImagesCached()V

    :cond_1b
    return-void
.end method