73 lines
2.0 KiB
Java
73 lines
2.0 KiB
Java
package c.c.a;
|
|
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.RestrictTo;
|
|
import java.util.LinkedHashSet;
|
|
import java.util.Set;
|
|
import java.util.concurrent.Callable;
|
|
import java.util.concurrent.ExecutionException;
|
|
import java.util.concurrent.Executor;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.FutureTask;
|
|
/* compiled from: LottieTask */
|
|
public class r<T> {
|
|
public static Executor a = Executors.newCachedThreadPool();
|
|
public final Set<l<T>> b = new LinkedHashSet(1);
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final Set<l<Throwable>> f273c = new LinkedHashSet(1);
|
|
public final Handler d = new Handler(Looper.getMainLooper());
|
|
@Nullable
|
|
public volatile p<T> e = null;
|
|
|
|
/* compiled from: LottieTask */
|
|
public class a extends FutureTask<p<T>> {
|
|
public a(Callable<p<T>> callable) {
|
|
super(callable);
|
|
}
|
|
|
|
@Override // java.util.concurrent.FutureTask
|
|
public void done() {
|
|
if (!isCancelled()) {
|
|
try {
|
|
r.this.c(get());
|
|
} catch (InterruptedException | ExecutionException e) {
|
|
r.this.c(new p<>(e));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
public r(Callable<p<T>> callable) {
|
|
a.execute(new a(callable));
|
|
}
|
|
|
|
public synchronized r<T> a(l<Throwable> lVar) {
|
|
if (!(this.e == null || this.e.b == null)) {
|
|
lVar.a(this.e.b);
|
|
}
|
|
this.f273c.add(lVar);
|
|
return this;
|
|
}
|
|
|
|
public synchronized r<T> b(l<T> lVar) {
|
|
if (!(this.e == null || this.e.a == null)) {
|
|
lVar.a(this.e.a);
|
|
}
|
|
this.b.add(lVar);
|
|
return this;
|
|
}
|
|
|
|
public final void c(@Nullable p<T> pVar) {
|
|
if (this.e == null) {
|
|
this.e = pVar;
|
|
this.d.post(new q(this));
|
|
return;
|
|
}
|
|
throw new IllegalStateException("A task may only be set once.");
|
|
}
|
|
}
|