jimu-decompiled/sources/com/baidu/cloud/videocache/ProxyCacheManager.java
2025-05-13 19:24:51 +02:00

75 lines
1.8 KiB
Java

package com.baidu.cloud.videocache;
import android.content.Context;
import java.io.File;
/* loaded from: classes.dex */
public final class ProxyCacheManager implements CacheListener {
private static ProxyCacheManager d;
private g a;
private CacheListener b;
private File c;
private g a(Context context) {
i iVar = new i(context.getApplicationContext());
iVar.a(a(context, this.c));
return iVar.a();
}
private File a(Context context, File file) {
if (file == null || (!file.exists() && !file.mkdirs())) {
file = ad.a(context);
}
this.c = file;
return file;
}
public static synchronized ProxyCacheManager b() {
ProxyCacheManager proxyCacheManager;
synchronized (ProxyCacheManager.class) {
if (d == null) {
d = new ProxyCacheManager();
}
proxyCacheManager = d;
}
return proxyCacheManager;
}
public static g b(Context context) {
g gVar = b().a;
if (gVar != null) {
return gVar;
}
ProxyCacheManager b = b();
g a = b().a(context);
b.a = a;
return a;
}
public String a(Context context, String str) {
if (!str.startsWith("http") || str.contains("127.0.0.1")) {
return str;
}
g b = b(context.getApplicationContext());
String a = b.a(str);
b.a(this, str);
return a;
}
public void a() {
g gVar = this.a;
if (gVar != null) {
gVar.a(this);
}
}
public void a(CacheListener cacheListener) {
this.b = cacheListener;
}
@Override // com.baidu.cloud.videocache.CacheListener
public void a(File file, String str, int i) {
this.b.a(file, str, i);
}
}