QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 LottieAnimHelper.java 源代码,内容仅作参考
package com.tencent.mtt.fileclean.utils;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
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.common.task.Continuation;
import com.tencent.common.task.QBTask;
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.mtt.nxeasy.task.PriorityCallable;
import com.tencent.mtt.nxeasy.task.PriorityTask;
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;
public class LottieAnimHelper {
private static volatile LottieAnimHelper f66181a;
private LottieAnimHelper() {
}
public static LottieAnimHelper a() {
if (f66181a == null) {
synchronized (LottieAnimHelper.class) {
if (f66181a == null) {
f66181a = new LottieAnimHelper();
}
}
}
return f66181a;
}
private void a(String str, String str2) {
a(str, str2, true);
}
private void a(String str, String str2, boolean z) {
if (!z || Build.VERSION.SDK_INT >= 24) {
ArrayList arrayList = new ArrayList();
ResponseInfo responseInfo = new ResponseInfo();
responseInfo.mTaskId = str2;
responseInfo.mAction = 0;
responseInfo.mEffectTime = 0L;
responseInfo.mInvalidTime = Long.MAX_VALUE;
responseInfo.mResMap = new HashMap<>();
Res res = new Res();
res.mUrl = str;
res.mType = 2;
res.mFlag = 1;
res.mFileName = "cover_anim";
res.mPreProcessFileName = "cover_anim_unzip";
responseInfo.mResMap.put(res.mFileName, res);
arrayList.add(responseInfo);
OperationManager.a().a(18, (Serializable) arrayList);
}
}
private ImageAssetDelegate c(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) {
final FileInputStream fileInputStream;
File file = new File(str);
if (file.exists()) {
try {
fileInputStream = new FileInputStream(file);
} catch (FileNotFoundException unused) {
}
if (fileInputStream == null) {
PriorityTask.a((PriorityCallable) new PriorityCallable<LottieComposition>() {
@Override
public LottieComposition call() throws Exception {
return LottieCompositionFactory.b(fileInputStream, (String) null).a();
}
}).a(new Continuation<LottieComposition, Object>() {
@Override
public Object then(QBTask<LottieComposition> qBTask) throws Exception {
LottieComposition e = qBTask.e();
if (e == null) {
return null;
}
lottieAnimationView.setComposition(e);
lottieAnimationView.playAnimation();
return null;
}
}, 6);
return;
} else {
if (fileInputStream != null) {
try {
fileInputStream.close();
return;
} catch (IOException unused2) {
return;
}
}
return;
}
}
fileInputStream = null;
if (fileInputStream == null) {
}
}
public void a(final LottieAnimationView lottieAnimationView, String str, String str2) {
final FileInputStream fileInputStream;
File file = new File(str);
File file2 = new File(str2);
if (file.exists()) {
try {
fileInputStream = new FileInputStream(file);
} catch (FileNotFoundException unused) {
}
if (fileInputStream == null && file2.exists()) {
lottieAnimationView.setImageAssetDelegate(c(file2.getAbsolutePath()));
PriorityTask.a((PriorityCallable) new PriorityCallable<LottieComposition>() {
@Override
public LottieComposition call() throws Exception {
return LottieCompositionFactory.b(fileInputStream, (String) null).a();
}
}).a(new Continuation<LottieComposition, Object>() {
@Override
public Object then(QBTask<LottieComposition> qBTask) throws Exception {
LottieComposition e = qBTask.e();
if (e == null) {
return null;
}
lottieAnimationView.setComposition(e);
lottieAnimationView.playAnimation();
return null;
}
}, 6);
return;
} else {
if (fileInputStream == null) {
try {
fileInputStream.close();
return;
} catch (IOException unused2) {
return;
}
}
return;
}
}
fileInputStream = null;
if (fileInputStream == null) {
}
if (fileInputStream == null) {
}
}
public boolean a(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();
}
public String b(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("cover_anim") || (res = allRes.get("cover_anim")) == null) {
return "";
}
File resPreProcessFile = res.getResPreProcessFile();
return resPreProcessFile.exists() ? resPreProcessFile.getAbsolutePath() : "";
}
public void b() {
if (!a("file_cleaning_page_anim_v2_new")) {
a("https://res.imtt.qq.com/res_mtt/file/brush.zip", "file_cleaning_page_anim_v2_new");
}
if (a("file_cleaning_page_anim_v3_new")) {
return;
}
a("https://static.res.qq.com/nav/file/new_brush.zip", "file_cleaning_page_anim_v3_new");
}
public void b(LottieAnimationView lottieAnimationView, String str, String str2) {
lottieAnimationView.setImageAssetsFolder(str2);
lottieAnimationView.setAnimation(str);
lottieAnimationView.playAnimation();
}
public void c() {
if (a("file_delete_feedback_anim")) {
return;
}
a("https://res.imtt.qq.com/res_mtt/file/delete_feedback_anim.zip", "file_delete_feedback_anim");
}
public void d() {
if (a("file_accelerate_page_anim")) {
return;
}
a("https://res.imtt.qq.com/res_mtt/file/accelerate_page_anim.zip", "file_accelerate_page_anim");
}
public void e() {
if (a("file_compress_video_anim")) {
return;
}
a("https://static.res.qq.com/nav/file/video_compress_anim.zip", "file_compress_video_anim");
}
public void f() {
if (a("file_compress_image_anim")) {
return;
}
a("https://static.res.qq.com/nav/file/clean/image_compress_anim.zip", "file_compress_image_anim");
}
public void g() {
if (a("file_preview_compress_image_anim")) {
return;
}
a("https://static.res.qq.com/nav/anim_junkclean_img_compress.zip", "file_preview_compress_image_anim");
}
public void h() {
if (a("file_mem_headsup_anim")) {
return;
}
a("https://res.imtt.qq.com/res_mtt/file/mem_headsup_anim.zip", "file_mem_headsup_anim");
}
public void i() {
if (a("file_apk_install_finish_anim_new")) {
return;
}
a("https://static.res.qq.com/nav/file/junk_install_clean_new.zip", "file_apk_install_finish_anim_new");
}
public void j() {
if (a("file_cleandonw_card_anim")) {
return;
}
a("https://res.imtt.qq.com/res_mtt/file/cleandone_card_anim.zip", "file_cleandonw_card_anim");
}
public void k() {
if (a("file_secret_space_encrypt_success_9.6")) {
return;
}
a("https://res.imtt.qq.com/res_mtt/file/secret_space_encrypt_success_anim_9.6.zip", "file_secret_space_encrypt_success_9.6", false);
}
}