QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 LottieResHelper.java 源代码,内容仅作参考
package com.tencent.mtt.res;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Handler;
import com.tencent.common.fresco.cache.FImage;
import com.tencent.common.fresco.pipeline.ImageHub;
import com.tencent.common.manifest.EventEmiter;
import com.tencent.common.manifest.EventMessage;
import com.tencent.mtt.lottie.ImageAssetDelegate;
import com.tencent.mtt.lottie.LottieAnimationView;
import com.tencent.mtt.lottie.LottieComposition;
import com.tencent.mtt.lottie.LottieCompositionFactory;
import com.tencent.mtt.lottie.LottieImageAsset;
import com.tencent.rmp.operation.res.OperationManager;
import com.tencent.rmp.operation.res.OperationTask;
import com.tencent.rmp.operation.res.Res;
import com.tencent.rmp.operation.res.ResponseInfo;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class LottieResHelper {
private static volatile LottieResHelper f69814a;
private Map<String, String> f69815b = new HashMap();
private LottieResHelper() {
this.f69815b.put("lottery_Lottie_anim", "https://static.res.qq.com/nav/file/lottery_lottie_0703.zip");
}
public static LottieResHelper a() {
if (f69814a == null) {
synchronized (LottieResHelper.class) {
if (f69814a == null) {
f69814a = new LottieResHelper();
}
}
}
return f69814a;
}
private String c(String str) {
OperationTask operationTask;
HashMap<String, Res> allRes;
Res res;
HashMap<String, OperationTask> a2 = OperationManager.a().a(18);
if (a2 == null || (operationTask = a2.get(str)) == null || operationTask.mRes == null || (allRes = operationTask.mRes.getAllRes()) == null || !allRes.containsKey("lottie_anim") || (res = allRes.get("lottie_anim")) == null) {
return "";
}
File resPreProcessFile = res.getResPreProcessFile();
return resPreProcessFile.exists() ? resPreProcessFile.getAbsolutePath() : "";
}
private ImageAssetDelegate d(final String str) {
return new ImageAssetDelegate() {
@Override
public Bitmap fetchBitmap(LottieImageAsset lottieImageAsset) {
String str2 = str + File.separator + lottieImageAsset.b();
FImage d2 = ImageHub.a().d(str2);
Bitmap b2 = d2 != null ? d2.b() : null;
if (b2 != null) {
return b2;
}
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = true;
b2 = BitmapFactory.decodeFile(str2, options);
ImageHub.a().a(str2, b2);
return b2;
} catch (Throwable th) {
if (!(th instanceof OutOfMemoryError)) {
return b2;
}
EventEmiter.getDefault().emit(new EventMessage("com.tencent.mtt.external.rqd.RQDManager.handleCatchException", Thread.currentThread(), new OutOfMemoryError("OutOfMemoryError"), "LottieAnimHelper_playLocalLottieAnim_OOM"));
return b2;
}
}
};
}
public void a(final LottieAnimationView lottieAnimationView, String str, String str2, String str3) {
final FileInputStream fileInputStream;
String c2 = c(str);
File file = new File(c2 + File.separator + str2);
File file2 = new File(c2 + File.separator + str3);
if (file.exists()) {
try {
fileInputStream = new FileInputStream(file);
} catch (FileNotFoundException unused) {
}
if (fileInputStream == null && file2.exists()) {
lottieAnimationView.setImageAssetDelegate(d(file2.getAbsolutePath()));
new Handler().post(new Runnable() {
@Override
public void run() {
LottieComposition a2 = LottieCompositionFactory.b(fileInputStream, (String) null).a();
if (a2 != null) {
lottieAnimationView.setComposition(a2);
lottieAnimationView.playAnimation();
}
}
});
return;
} else {
if (fileInputStream == null) {
try {
fileInputStream.close();
return;
} catch (IOException unused2) {
return;
}
}
return;
}
}
fileInputStream = null;
if (fileInputStream == null) {
}
if (fileInputStream == null) {
}
}
public void a(String str) {
a(str, true);
}
public void a(String str, boolean z) {
if ((!z || Build.VERSION.SDK_INT >= 24) && !b(str)) {
ResponseInfo responseInfo = new ResponseInfo();
responseInfo.mTaskId = str;
responseInfo.mAction = 0;
responseInfo.mEffectTime = 0L;
responseInfo.mInvalidTime = Long.MAX_VALUE;
responseInfo.mResMap = new HashMap<>();
Res res = new Res();
res.mUrl = this.f69815b.get(str);
res.mType = 2;
res.mFlag = 1;
res.mFileName = "lottie_anim";
res.mPreProcessFileName = "browser_lottie_unzip";
responseInfo.mResMap.put(res.mFileName, res);
ArrayList arrayList = new ArrayList();
arrayList.add(responseInfo);
OperationManager.a().a(18, (Serializable) arrayList);
}
}
public boolean b(String str) {
OperationTask operationTask;
HashMap<String, OperationTask> a2 = OperationManager.a().a(18);
if (a2 == null || (operationTask = a2.get(str)) == null || operationTask.mRes == null) {
return false;
}
return operationTask.mRes.isAllResReady();
}
}