Rabbit-R1/original r1/smali/smali_classes2/com/airbnb/lottie/LottieTask.smali
2024-05-21 17:08:36 -04:00

653 lines
16 KiB
Smali

.class public Lcom/airbnb/lottie/LottieTask;
.super Ljava/lang/Object;
.source "LottieTask.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/airbnb/lottie/LottieTask$LottieFutureTask;
}
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Ljava/lang/Object;"
}
.end annotation
# static fields
.field public static EXECUTOR:Ljava/util/concurrent/Executor;
# instance fields
.field private final failureListeners:Ljava/util/Set;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set<",
"Lcom/airbnb/lottie/LottieListener<",
"Ljava/lang/Throwable;",
">;>;"
}
.end annotation
.end field
.field private final handler:Landroid/os/Handler;
.field private volatile result:Lcom/airbnb/lottie/LottieResult;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/airbnb/lottie/LottieResult<",
"TT;>;"
}
.end annotation
.end field
.field private final successListeners:Ljava/util/Set;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set<",
"Lcom/airbnb/lottie/LottieListener<",
"TT;>;>;"
}
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.locals 1
.line 38
invoke-static {}, Ljava/util/concurrent/Executors;->newCachedThreadPool()Ljava/util/concurrent/ExecutorService;
move-result-object v0
sput-object v0, Lcom/airbnb/lottie/LottieTask;->EXECUTOR:Ljava/util/concurrent/Executor;
return-void
.end method
.method public constructor <init>(Ljava/lang/Object;)V
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(TT;)V"
}
.end annotation
.line 52
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 41
new-instance v0, Ljava/util/LinkedHashSet;
const/4 v1, 0x1
invoke-direct {v0, v1}, Ljava/util/LinkedHashSet;-><init>(I)V
iput-object v0, p0, Lcom/airbnb/lottie/LottieTask;->successListeners:Ljava/util/Set;
.line 42
new-instance v0, Ljava/util/LinkedHashSet;
invoke-direct {v0, v1}, Ljava/util/LinkedHashSet;-><init>(I)V
iput-object v0, p0, Lcom/airbnb/lottie/LottieTask;->failureListeners:Ljava/util/Set;
.line 43
new-instance v0, Landroid/os/Handler;
invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;
move-result-object v1
invoke-direct {v0, v1}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V
iput-object v0, p0, Lcom/airbnb/lottie/LottieTask;->handler:Landroid/os/Handler;
const/4 v0, 0x0
iput-object v0, p0, Lcom/airbnb/lottie/LottieTask;->result:Lcom/airbnb/lottie/LottieResult;
.line 53
new-instance v0, Lcom/airbnb/lottie/LottieResult;
invoke-direct {v0, p1}, Lcom/airbnb/lottie/LottieResult;-><init>(Ljava/lang/Object;)V
invoke-direct {p0, v0}, Lcom/airbnb/lottie/LottieTask;->setResult(Lcom/airbnb/lottie/LottieResult;)V
return-void
.end method
.method public constructor <init>(Ljava/util/concurrent/Callable;)V
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/concurrent/Callable<",
"Lcom/airbnb/lottie/LottieResult<",
"TT;>;>;)V"
}
.end annotation
const/4 v0, 0x0
.line 49
invoke-direct {p0, p1, v0}, Lcom/airbnb/lottie/LottieTask;-><init>(Ljava/util/concurrent/Callable;Z)V
return-void
.end method
.method constructor <init>(Ljava/util/concurrent/Callable;Z)V
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/concurrent/Callable<",
"Lcom/airbnb/lottie/LottieResult<",
"TT;>;>;Z)V"
}
.end annotation
.line 59
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 41
new-instance v0, Ljava/util/LinkedHashSet;
const/4 v1, 0x1
invoke-direct {v0, v1}, Ljava/util/LinkedHashSet;-><init>(I)V
iput-object v0, p0, Lcom/airbnb/lottie/LottieTask;->successListeners:Ljava/util/Set;
.line 42
new-instance v0, Ljava/util/LinkedHashSet;
invoke-direct {v0, v1}, Ljava/util/LinkedHashSet;-><init>(I)V
iput-object v0, p0, Lcom/airbnb/lottie/LottieTask;->failureListeners:Ljava/util/Set;
.line 43
new-instance v0, Landroid/os/Handler;
invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;
move-result-object v1
invoke-direct {v0, v1}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V
iput-object v0, p0, Lcom/airbnb/lottie/LottieTask;->handler:Landroid/os/Handler;
const/4 v0, 0x0
iput-object v0, p0, Lcom/airbnb/lottie/LottieTask;->result:Lcom/airbnb/lottie/LottieResult;
if-eqz p2, :cond_0
.line 62
:try_start_0
invoke-interface {p1}, Ljava/util/concurrent/Callable;->call()Ljava/lang/Object;
move-result-object p1
check-cast p1, Lcom/airbnb/lottie/LottieResult;
invoke-direct {p0, p1}, Lcom/airbnb/lottie/LottieTask;->setResult(Lcom/airbnb/lottie/LottieResult;)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_0
:catchall_0
move-exception p1
.line 64
new-instance p2, Lcom/airbnb/lottie/LottieResult;
invoke-direct {p2, p1}, Lcom/airbnb/lottie/LottieResult;-><init>(Ljava/lang/Throwable;)V
invoke-direct {p0, p2}, Lcom/airbnb/lottie/LottieTask;->setResult(Lcom/airbnb/lottie/LottieResult;)V
goto :goto_0
:cond_0
sget-object p2, Lcom/airbnb/lottie/LottieTask;->EXECUTOR:Ljava/util/concurrent/Executor;
.line 67
new-instance v0, Lcom/airbnb/lottie/LottieTask$LottieFutureTask;
invoke-direct {v0, p0, p1}, Lcom/airbnb/lottie/LottieTask$LottieFutureTask;-><init>(Lcom/airbnb/lottie/LottieTask;Ljava/util/concurrent/Callable;)V
invoke-interface {p2, v0}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
:goto_0
return-void
.end method
.method static synthetic access$000(Lcom/airbnb/lottie/LottieTask;Lcom/airbnb/lottie/LottieResult;)V
.locals 0
.line 29
invoke-direct {p0, p1}, Lcom/airbnb/lottie/LottieTask;->setResult(Lcom/airbnb/lottie/LottieResult;)V
return-void
.end method
.method private declared-synchronized notifyFailureListeners(Ljava/lang/Throwable;)V
.locals 2
monitor-enter p0
.line 165
:try_start_0
new-instance v0, Ljava/util/ArrayList;
iget-object v1, p0, Lcom/airbnb/lottie/LottieTask;->failureListeners:Ljava/util/Set;
invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V
.line 166
invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
move-result v1
if-eqz v1, :cond_0
const-string v0, "Lottie encountered an error but no failure listener was added:"
.line 167
invoke-static {v0, p1}, Lcom/airbnb/lottie/utils/Logger;->warning(Ljava/lang/String;Ljava/lang/Throwable;)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 168
monitor-exit p0
return-void
.line 171
:cond_0
:try_start_1
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v0
:goto_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_1
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Lcom/airbnb/lottie/LottieListener;
.line 172
invoke-interface {v1, p1}, Lcom/airbnb/lottie/LottieListener;->onResult(Ljava/lang/Object;)V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
goto :goto_0
.line 174
:cond_1
monitor-exit p0
return-void
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method
.method private notifyListeners()V
.locals 2
iget-object v0, p0, Lcom/airbnb/lottie/LottieTask;->handler:Landroid/os/Handler;
.line 139
new-instance v1, Lcom/airbnb/lottie/LottieTask$$ExternalSyntheticLambda0;
invoke-direct {v1, p0}, Lcom/airbnb/lottie/LottieTask$$ExternalSyntheticLambda0;-><init>(Lcom/airbnb/lottie/LottieTask;)V
invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z
return-void
.end method
.method private declared-synchronized notifySuccessListeners(Ljava/lang/Object;)V
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(TT;)V"
}
.end annotation
monitor-enter p0
.line 156
:try_start_0
new-instance v0, Ljava/util/ArrayList;
iget-object v1, p0, Lcom/airbnb/lottie/LottieTask;->successListeners:Ljava/util/Set;
invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V
.line 157
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v0
:goto_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_0
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Lcom/airbnb/lottie/LottieListener;
.line 158
invoke-interface {v1, p1}, Lcom/airbnb/lottie/LottieListener;->onResult(Ljava/lang/Object;)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_0
.line 160
:cond_0
monitor-exit p0
return-void
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method
.method private setResult(Lcom/airbnb/lottie/LottieResult;)V
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/airbnb/lottie/LottieResult<",
"TT;>;)V"
}
.end annotation
iget-object v0, p0, Lcom/airbnb/lottie/LottieTask;->result:Lcom/airbnb/lottie/LottieResult;
if-nez v0, :cond_0
iput-object p1, p0, Lcom/airbnb/lottie/LottieTask;->result:Lcom/airbnb/lottie/LottieResult;
.line 76
invoke-direct {p0}, Lcom/airbnb/lottie/LottieTask;->notifyListeners()V
return-void
.line 73
:cond_0
new-instance p0, Ljava/lang/IllegalStateException;
const-string p1, "A task may only be set once."
invoke-direct {p0, p1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p0
.end method
# virtual methods
.method public declared-synchronized addFailureListener(Lcom/airbnb/lottie/LottieListener;)Lcom/airbnb/lottie/LottieTask;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/airbnb/lottie/LottieListener<",
"Ljava/lang/Throwable;",
">;)",
"Lcom/airbnb/lottie/LottieTask<",
"TT;>;"
}
.end annotation
monitor-enter p0
:try_start_0
iget-object v0, p0, Lcom/airbnb/lottie/LottieTask;->result:Lcom/airbnb/lottie/LottieResult;
if-eqz v0, :cond_0
.line 113
invoke-virtual {v0}, Lcom/airbnb/lottie/LottieResult;->getException()Ljava/lang/Throwable;
move-result-object v1
if-eqz v1, :cond_0
.line 114
invoke-virtual {v0}, Lcom/airbnb/lottie/LottieResult;->getException()Ljava/lang/Throwable;
move-result-object v0
invoke-interface {p1, v0}, Lcom/airbnb/lottie/LottieListener;->onResult(Ljava/lang/Object;)V
:cond_0
iget-object v0, p0, Lcom/airbnb/lottie/LottieTask;->failureListeners:Ljava/util/Set;
.line 117
invoke-interface {v0, p1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 118
monitor-exit p0
return-object p0
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method
.method public declared-synchronized addListener(Lcom/airbnb/lottie/LottieListener;)Lcom/airbnb/lottie/LottieTask;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/airbnb/lottie/LottieListener<",
"TT;>;)",
"Lcom/airbnb/lottie/LottieTask<",
"TT;>;"
}
.end annotation
monitor-enter p0
:try_start_0
iget-object v0, p0, Lcom/airbnb/lottie/LottieTask;->result:Lcom/airbnb/lottie/LottieResult;
if-eqz v0, :cond_0
.line 86
invoke-virtual {v0}, Lcom/airbnb/lottie/LottieResult;->getValue()Ljava/lang/Object;
move-result-object v1
if-eqz v1, :cond_0
.line 87
invoke-virtual {v0}, Lcom/airbnb/lottie/LottieResult;->getValue()Ljava/lang/Object;
move-result-object v0
invoke-interface {p1, v0}, Lcom/airbnb/lottie/LottieListener;->onResult(Ljava/lang/Object;)V
:cond_0
iget-object v0, p0, Lcom/airbnb/lottie/LottieTask;->successListeners:Ljava/util/Set;
.line 90
invoke-interface {v0, p1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 91
monitor-exit p0
return-object p0
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method
.method public getResult()Lcom/airbnb/lottie/LottieResult;
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Lcom/airbnb/lottie/LottieResult<",
"TT;>;"
}
.end annotation
iget-object p0, p0, Lcom/airbnb/lottie/LottieTask;->result:Lcom/airbnb/lottie/LottieResult;
return-object p0
.end method
.method synthetic lambda$notifyListeners$0$com-airbnb-lottie-LottieTask()V
.locals 2
.line 0
iget-object v0, p0, Lcom/airbnb/lottie/LottieTask;->result:Lcom/airbnb/lottie/LottieResult;
if-nez v0, :cond_0
return-void
.line 145
:cond_0
invoke-virtual {v0}, Lcom/airbnb/lottie/LottieResult;->getValue()Ljava/lang/Object;
move-result-object v1
if-eqz v1, :cond_1
.line 146
invoke-virtual {v0}, Lcom/airbnb/lottie/LottieResult;->getValue()Ljava/lang/Object;
move-result-object v0
invoke-direct {p0, v0}, Lcom/airbnb/lottie/LottieTask;->notifySuccessListeners(Ljava/lang/Object;)V
goto :goto_0
.line 148
:cond_1
invoke-virtual {v0}, Lcom/airbnb/lottie/LottieResult;->getException()Ljava/lang/Throwable;
move-result-object v0
invoke-direct {p0, v0}, Lcom/airbnb/lottie/LottieTask;->notifyFailureListeners(Ljava/lang/Throwable;)V
:goto_0
return-void
.end method
.method public declared-synchronized removeFailureListener(Lcom/airbnb/lottie/LottieListener;)Lcom/airbnb/lottie/LottieTask;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/airbnb/lottie/LottieListener<",
"Ljava/lang/Throwable;",
">;)",
"Lcom/airbnb/lottie/LottieTask<",
"TT;>;"
}
.end annotation
monitor-enter p0
:try_start_0
iget-object v0, p0, Lcom/airbnb/lottie/LottieTask;->failureListeners:Ljava/util/Set;
.line 128
invoke-interface {v0, p1}, Ljava/util/Set;->remove(Ljava/lang/Object;)Z
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 129
monitor-exit p0
return-object p0
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method
.method public declared-synchronized removeListener(Lcom/airbnb/lottie/LottieListener;)Lcom/airbnb/lottie/LottieTask;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/airbnb/lottie/LottieListener<",
"TT;>;)",
"Lcom/airbnb/lottie/LottieTask<",
"TT;>;"
}
.end annotation
monitor-enter p0
:try_start_0
iget-object v0, p0, Lcom/airbnb/lottie/LottieTask;->successListeners:Ljava/util/Set;
.line 101
invoke-interface {v0, p1}, Ljava/util/Set;->remove(Ljava/lang/Object;)Z
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 102
monitor-exit p0
return-object p0
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method