bl.smali

.class public final Lcom/lottie/bl;
.super Ljava/lang/Object;
.source "LottieComposition.java"


# static fields
.field private static bug:I

.field private static buh:I

.field private static bui:I

.field private static buj:I

.field private static buk:Ljava/util/concurrent/Executor;

.field private static final ov:Ljava/util/concurrent/ThreadFactory;

.field private static final ow:Ljava/util/concurrent/BlockingQueue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/BlockingQueue",
            "<",
            "Ljava/lang/Runnable;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method static constructor <clinit>()V
    .registers 9

    .prologue
    .line 140
    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Runtime;->availableProcessors()I

    move-result v0

    .line 141
    sput v0, Lcom/lottie/bl;->bug:I

    add-int/lit8 v0, v0, 0x1

    sput v0, Lcom/lottie/bl;->buh:I

    .line 142
    sget v0, Lcom/lottie/bl;->bug:I

    shl-int/lit8 v0, v0, 0x1

    add-int/lit8 v0, v0, 0x1

    sput v0, Lcom/lottie/bl;->bui:I

    .line 143
    const/4 v0, 0x1

    sput v0, Lcom/lottie/bl;->buj:I

    .line 145
    new-instance v0, Lcom/lottie/bl$1;

    invoke-direct {v0}, Lcom/lottie/bl$1;-><init>()V

    sput-object v0, Lcom/lottie/bl;->ov:Ljava/util/concurrent/ThreadFactory;

    .line 153
    new-instance v0, Ljava/util/concurrent/LinkedBlockingQueue;

    const/16 v1, 0x80

    invoke-direct {v0, v1}, Ljava/util/concurrent/LinkedBlockingQueue;-><init>(I)V

    sput-object v0, Lcom/lottie/bl;->ow:Ljava/util/concurrent/BlockingQueue;

    .line 156
    new-instance v1, Ljava/util/concurrent/ThreadPoolExecutor;

    sget v2, Lcom/lottie/bl;->buh:I

    sget v3, Lcom/lottie/bl;->bui:I

    sget v0, Lcom/lottie/bl;->buj:I

    int-to-long v4, v0

    sget-object v6, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;

    sget-object v7, Lcom/lottie/bl;->ow:Ljava/util/concurrent/BlockingQueue;

    sget-object v8, Lcom/lottie/bl;->ov:Ljava/util/concurrent/ThreadFactory;

    invoke-direct/range {v1 .. v8}, Ljava/util/concurrent/ThreadPoolExecutor;-><init>(IIJLjava/util/concurrent/TimeUnit;Ljava/util/concurrent/BlockingQueue;Ljava/util/concurrent/ThreadFactory;)V

    sput-object v1, Lcom/lottie/bl;->buk:Ljava/util/concurrent/Executor;

    return-void
.end method

.method public static a(Landroid/content/Context;Ljava/lang/String;Lcom/lottie/bt;)Lcom/lottie/af;
    .registers 8

    .prologue
    .line 120
    :try_start_0
    invoke-virtual {p0}, Landroid/content/Context;->getAssets()Landroid/content/res/AssetManager;

    move-result-object v0

    invoke-virtual {v0, p1}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;)Ljava/io/InputStream;
    :try_end_7
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_7} :catch_1d

    move-result-object v0

    .line 1134
    new-instance v1, Lcom/lottie/aq;

    .line 1135
    invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    invoke-direct {v1, v2, p2}, Lcom/lottie/aq;-><init>(Landroid/content/res/Resources;Lcom/lottie/bt;)V

    .line 1136
    sget-object v2, Landroid/os/AsyncTask;->THREAD_POOL_EXECUTOR:Ljava/util/concurrent/Executor;

    const/4 v3, 0x1

    new-array v3, v3, [Ljava/io/InputStream;

    const/4 v4, 0x0

    aput-object v0, v3, v4

    invoke-virtual {v1, v2, v3}, Lcom/lottie/aq;->executeOnExecutor(Ljava/util/concurrent/Executor;[Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 124
    return-object v1

    .line 121
    :catch_1d
    move-exception v0

    .line 122
    new-instance v1, Ljava/lang/IllegalStateException;

    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "Unable to find file "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, v2, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1
.end method

.method static a(Landroid/content/res/Resources;Ljava/io/InputStream;)Lcom/lottie/bk;
    .registers 12

    .prologue
    const/4 v4, -0x1

    .line 207
    :try_start_1
    invoke-virtual {p1}, Ljava/io/InputStream;->available()I

    move-result v0

    .line 208
    new-array v0, v0, [B

    .line 210
    invoke-virtual {p1, v0}, Ljava/io/InputStream;->read([B)I

    .line 211
    new-instance v1, Ljava/lang/String;

    const-string v2, "UTF-8"

    invoke-direct {v1, v0, v2}, Ljava/lang/String;-><init>([BLjava/lang/String;)V

    .line 212
    new-instance v9, Lorg/json/JSONObject;

    invoke-direct {v9, v1}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 1225
    const/4 v1, 0x0

    .line 1226
    invoke-virtual {p0}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v0

    iget v7, v0, Landroid/util/DisplayMetrics;->density:F

    .line 1227
    const-string v0, "w"

    const/4 v2, -0x1

    invoke-virtual {v9, v0, v2}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;I)I

    move-result v0

    .line 1228
    const-string v2, "h"

    const/4 v3, -0x1

    invoke-virtual {v9, v2, v3}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;I)I

    move-result v2

    .line 1230
    if-eq v0, v4, :cond_3c

    if-eq v2, v4, :cond_3c

    .line 1231
    int-to-float v0, v0

    mul-float/2addr v0, v7

    float-to-int v0, v0

    .line 1232
    int-to-float v1, v2

    mul-float/2addr v1, v7

    float-to-int v2, v1

    .line 1233
    new-instance v1, Landroid/graphics/Rect;

    const/4 v3, 0x0

    const/4 v4, 0x0

    invoke-direct {v1, v3, v4, v0, v2}, Landroid/graphics/Rect;-><init>(IIII)V

    .line 1236
    :cond_3c
    const-string v0, "ip"

    const-wide/16 v2, 0x0

    invoke-virtual {v9, v0, v2, v3}, Lorg/json/JSONObject;->optLong(Ljava/lang/String;J)J

    move-result-wide v2

    .line 1237
    const-string v0, "op"

    const-wide/16 v4, 0x0

    invoke-virtual {v9, v0, v4, v5}, Lorg/json/JSONObject;->optLong(Ljava/lang/String;J)J

    move-result-wide v4

    .line 1238
    const-string v0, "fr"

    const/4 v6, 0x0

    invoke-virtual {v9, v0, v6}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;I)I

    move-result v6

    .line 1239
    new-instance v0, Lcom/lottie/bk;

    const/4 v8, 0x0

    invoke-direct/range {v0 .. v8}, Lcom/lottie/bk;-><init>(Landroid/graphics/Rect;JJIFB)V

    .line 1241
    const-string v1, "assets"

    invoke-virtual {v9, v1}, Lorg/json/JSONObject;->optJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v1

    .line 1242
    invoke-static {v1, v0}, Lcom/lottie/bl;->b(Lorg/json/JSONArray;Lcom/lottie/bk;)V

    .line 1243
    invoke-static {v1, v0}, Lcom/lottie/bl;->a(Lorg/json/JSONArray;Lcom/lottie/bk;)V

    .line 1244
    invoke-static {v9, v0}, Lcom/lottie/bl;->k(Lorg/json/JSONObject;Lcom/lottie/bk;)V
    :try_end_68
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_68} :catch_6c
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_68} :catch_7a
    .catchall {:try_start_1 .. :try_end_68} :catchall_75

    .line 219
    invoke-static {p1}, Lcom/lottie/cx;->closeQuietly(Ljava/io/Closeable;)V

    .line 213
    return-object v0

    .line 214
    :catch_6c
    move-exception v0

    .line 215
    :try_start_6d
    new-instance v1, Ljava/lang/IllegalStateException;

    const-string v2, "Unable to find file."

    invoke-direct {v1, v2, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1
    :try_end_75
    .catchall {:try_start_6d .. :try_end_75} :catchall_75

    .line 219
    :catchall_75
    move-exception v0

    invoke-static {p1}, Lcom/lottie/cx;->closeQuietly(Ljava/io/Closeable;)V

    throw v0

    .line 216
    :catch_7a
    move-exception v0

    .line 217
    :try_start_7b
    new-instance v1, Ljava/lang/IllegalStateException;

    const-string v2, "Unable to load JSON."

    invoke-direct {v1, v2, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1
    :try_end_83
    .catchall {:try_start_7b .. :try_end_83} :catchall_75
.end method

.method private static a(Lorg/json/JSONArray;Lcom/lottie/bk;)V
    .registers 14

    .prologue
    const/4 v1, 0x0

    .line 259
    if-nez p0, :cond_4

    .line 279
    :cond_3
    return-void

    .line 262
    :cond_4
    invoke-virtual {p0}, Lorg/json/JSONArray;->length()I

    move-result v3

    move v2, v1

    .line 263
    :goto_9
    if-ge v2, v3, :cond_3

    .line 264
    invoke-virtual {p0, v2}, Lorg/json/JSONArray;->optJSONObject(I)Lorg/json/JSONObject;

    move-result-object v4

    .line 265
    const-string v0, "layers"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->optJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v5

    .line 266
    if-eqz v5, :cond_4a

    .line 269
    new-instance v6, Ljava/util/ArrayList;

    invoke-virtual {v5}, Lorg/json/JSONArray;->length()I

    move-result v0

    invoke-direct {v6, v0}, Ljava/util/ArrayList;-><init>(I)V

    .line 270
    new-instance v7, Landroid/support/v4/f/f;

    invoke-direct {v7}, Landroid/support/v4/f/f;-><init>()V

    move v0, v1

    .line 271
    :goto_26
    invoke-virtual {v5}, Lorg/json/JSONArray;->length()I

    move-result v8

    if-ge v0, v8, :cond_3f

    .line 272
    invoke-virtual {v5, v0}, Lorg/json/JSONArray;->optJSONObject(I)Lorg/json/JSONObject;

    move-result-object v8

    invoke-static {v8, p1}, Lcom/lottie/bj;->j(Lorg/json/JSONObject;Lcom/lottie/bk;)Lcom/lottie/Layer;

    move-result-object v8

    .line 5120
    iget-wide v10, v8, Lcom/lottie/Layer;->btq:J

    .line 273
    invoke-virtual {v7, v10, v11, v8}, Landroid/support/v4/f/f;->put(JLjava/lang/Object;)V

    .line 274
    invoke-interface {v6, v8}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 271
    add-int/lit8 v0, v0, 0x1

    goto :goto_26

    .line 276
    :cond_3f
    const-string v0, "id"

    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 6036
    iget-object v4, p1, Lcom/lottie/bk;->btY:Ljava/util/Map;

    .line 277
    invoke-interface {v4, v0, v6}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 263
    :cond_4a
    add-int/lit8 v0, v2, 0x1

    move v2, v0

    goto :goto_9
.end method

.method public static b(Landroid/content/Context;Ljava/lang/String;Lcom/lottie/bt;)Lcom/lottie/af;
    .registers 8

    .prologue
    .line 166
    :try_start_0
    invoke-virtual {p0}, Landroid/content/Context;->getAssets()Landroid/content/res/AssetManager;

    move-result-object v0

    invoke-virtual {v0, p1}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;)Ljava/io/InputStream;
    :try_end_7
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_7} :catch_1d

    move-result-object v0

    .line 1176
    new-instance v1, Lcom/lottie/aq;

    .line 1177
    invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    invoke-direct {v1, v2, p2}, Lcom/lottie/aq;-><init>(Landroid/content/res/Resources;Lcom/lottie/bt;)V

    .line 1178
    sget-object v2, Lcom/lottie/bl;->buk:Ljava/util/concurrent/Executor;

    const/4 v3, 0x1

    new-array v3, v3, [Ljava/io/InputStream;

    const/4 v4, 0x0

    aput-object v0, v3, v4

    invoke-virtual {v1, v2, v3}, Lcom/lottie/aq;->executeOnExecutor(Ljava/util/concurrent/Executor;[Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 170
    return-object v1

    .line 167
    :catch_1d
    move-exception v0

    .line 168
    new-instance v1, Ljava/lang/IllegalStateException;

    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "Unable to find file "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, v2, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1
.end method

.method private static b(Lorg/json/JSONArray;Lcom/lottie/bk;)V
    .registers 9

    .prologue
    const/4 v1, 0x0

    .line 283
    if-nez p0, :cond_4

    .line 295
    :cond_3
    return-void

    .line 286
    :cond_4
    invoke-virtual {p0}, Lorg/json/JSONArray;->length()I

    move-result v2

    move v0, v1

    .line 287
    :goto_9
    if-ge v0, v2, :cond_3

    .line 288
    invoke-virtual {p0, v0}, Lorg/json/JSONArray;->optJSONObject(I)Lorg/json/JSONObject;

    move-result-object v3

    .line 289
    const-string v4, "p"

    invoke-virtual {v3, v4}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v4

    if-eqz v4, :cond_39

    .line 7027
    new-instance v4, Lcom/lottie/bo;

    const-string v5, "w"

    invoke-virtual {v3, v5}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;)I

    const-string v5, "h"

    invoke-virtual {v3, v5}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;)I

    const-string v5, "id"

    invoke-virtual {v3, v5}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    const-string v6, "p"

    .line 7028
    invoke-virtual {v3, v6}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v4, v5, v3, v1}, Lcom/lottie/bo;-><init>(Ljava/lang/String;Ljava/lang/String;B)V

    .line 7036
    iget-object v3, p1, Lcom/lottie/bk;->btZ:Ljava/util/Map;

    .line 7041
    iget-object v5, v4, Lcom/lottie/bo;->id:Ljava/lang/String;

    .line 293
    invoke-interface {v3, v5, v4}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 287
    :cond_39
    add-int/lit8 v0, v0, 0x1

    goto :goto_9
.end method

.method private static k(Lorg/json/JSONObject;Lcom/lottie/bk;)V
    .registers 10

    .prologue
    .line 249
    const-string v0, "layers"

    invoke-virtual {p0, v0}, Lorg/json/JSONObject;->optJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v1

    .line 250
    invoke-virtual {v1}, Lorg/json/JSONArray;->length()I

    move-result v2

    .line 251
    const/4 v0, 0x0

    :goto_b
    if-ge v0, v2, :cond_24

    .line 252
    invoke-virtual {v1, v0}, Lorg/json/JSONArray;->optJSONObject(I)Lorg/json/JSONObject;

    move-result-object v3

    invoke-static {v3, p1}, Lcom/lottie/bj;->j(Lorg/json/JSONObject;Lcom/lottie/bk;)Lcom/lottie/Layer;

    move-result-object v3

    .line 2036
    iget-object v4, p1, Lcom/lottie/bk;->bsr:Ljava/util/List;

    .line 3036
    iget-object v5, p1, Lcom/lottie/bk;->bua:Landroid/support/v4/f/f;

    .line 3298
    invoke-interface {v4, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 4120
    iget-wide v6, v3, Lcom/lottie/Layer;->btq:J

    .line 3299
    invoke-virtual {v5, v6, v7, v3}, Landroid/support/v4/f/f;->put(JLjava/lang/Object;)V

    .line 251
    add-int/lit8 v0, v0, 0x1

    goto :goto_b

    .line 255
    :cond_24
    return-void
.end method