89 lines
3.4 KiB
Java
89 lines
3.4 KiB
Java
|
package com.airbnb.lottie;
|
||
|
|
||
|
import com.airbnb.lottie.network.LottieNetworkCacheProvider;
|
||
|
import com.airbnb.lottie.network.LottieNetworkFetcher;
|
||
|
import java.io.File;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class LottieConfig {
|
||
|
final LottieNetworkCacheProvider cacheProvider;
|
||
|
final boolean enableSystraceMarkers;
|
||
|
final LottieNetworkFetcher networkFetcher;
|
||
|
|
||
|
private LottieConfig(LottieNetworkFetcher lottieNetworkFetcher, LottieNetworkCacheProvider lottieNetworkCacheProvider, boolean z) {
|
||
|
this.networkFetcher = lottieNetworkFetcher;
|
||
|
this.cacheProvider = lottieNetworkCacheProvider;
|
||
|
this.enableSystraceMarkers = z;
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public static final class Builder {
|
||
|
private LottieNetworkCacheProvider cacheProvider;
|
||
|
private boolean enableSystraceMarkers = false;
|
||
|
private LottieNetworkFetcher networkFetcher;
|
||
|
|
||
|
public final Builder setNetworkCacheDir(File file) {
|
||
|
if (this.cacheProvider != null) {
|
||
|
throw new IllegalStateException("There is already a cache provider!");
|
||
|
}
|
||
|
this.cacheProvider = new LottieNetworkCacheProvider(this, file) { // from class: com.airbnb.lottie.LottieConfig.Builder.1
|
||
|
final Builder this$0;
|
||
|
final File val$file;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
this.val$file = file;
|
||
|
}
|
||
|
|
||
|
@Override // com.airbnb.lottie.network.LottieNetworkCacheProvider
|
||
|
public File getCacheDir() {
|
||
|
if (this.val$file.isDirectory()) {
|
||
|
return this.val$file;
|
||
|
}
|
||
|
throw new IllegalArgumentException("cache file must be a directory");
|
||
|
}
|
||
|
};
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Builder setNetworkCacheProvider(LottieNetworkCacheProvider lottieNetworkCacheProvider) {
|
||
|
if (this.cacheProvider != null) {
|
||
|
throw new IllegalStateException("There is already a cache provider!");
|
||
|
}
|
||
|
this.cacheProvider = new LottieNetworkCacheProvider(this, lottieNetworkCacheProvider) { // from class: com.airbnb.lottie.LottieConfig.Builder.2
|
||
|
final Builder this$0;
|
||
|
final LottieNetworkCacheProvider val$fileCacheProvider;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
this.val$fileCacheProvider = lottieNetworkCacheProvider;
|
||
|
}
|
||
|
|
||
|
@Override // com.airbnb.lottie.network.LottieNetworkCacheProvider
|
||
|
public File getCacheDir() {
|
||
|
File cacheDir = this.val$fileCacheProvider.getCacheDir();
|
||
|
if (cacheDir.isDirectory()) {
|
||
|
return cacheDir;
|
||
|
}
|
||
|
throw new IllegalArgumentException("cache file must be a directory");
|
||
|
}
|
||
|
};
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final LottieConfig build() {
|
||
|
return new LottieConfig(this.networkFetcher, this.cacheProvider, this.enableSystraceMarkers);
|
||
|
}
|
||
|
|
||
|
public final Builder setNetworkFetcher(LottieNetworkFetcher lottieNetworkFetcher) {
|
||
|
this.networkFetcher = lottieNetworkFetcher;
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Builder setEnableSystraceMarkers(boolean z) {
|
||
|
this.enableSystraceMarkers = z;
|
||
|
return this;
|
||
|
}
|
||
|
}
|
||
|
}
|