- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
254 lines
11 KiB
Java
254 lines
11 KiB
Java
package com.mbridge.msdk.splash.c;
|
|
|
|
import android.graphics.Bitmap;
|
|
import android.text.TextUtils;
|
|
import com.mbridge.msdk.c.h;
|
|
import com.mbridge.msdk.c.i;
|
|
import com.mbridge.msdk.foundation.download.download.H5DownLoadManager;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import com.mbridge.msdk.splash.c.g;
|
|
import com.mbridge.msdk.splash.view.MBSplashView;
|
|
import java.io.File;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class d {
|
|
public static com.mbridge.msdk.foundation.db.e a = com.mbridge.msdk.foundation.db.e.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.c.m().c()));
|
|
private static String b = "ResManager";
|
|
private static int c = 1;
|
|
|
|
public static CampaignEx a(MBSplashView mBSplashView, String str, String str2, String str3, boolean z, int i, boolean z2, boolean z3) {
|
|
if (a == null) {
|
|
a = com.mbridge.msdk.foundation.db.e.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.c.m().c()));
|
|
}
|
|
com.mbridge.msdk.c.g b2 = h.a().b(com.mbridge.msdk.foundation.controller.c.m().k());
|
|
if (b2 == null) {
|
|
h.a();
|
|
b2 = i.a();
|
|
}
|
|
long ac = b2.ac() * 1000;
|
|
long ad = b2.ad() * 1000;
|
|
if (a == null) {
|
|
a = com.mbridge.msdk.foundation.db.e.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.c.m().c()));
|
|
}
|
|
a.b(ad, str2);
|
|
List<CampaignEx> a2 = a.a(str2, 0, 0, c, !TextUtils.isEmpty(str3));
|
|
if (a2 == null || a2.size() <= 0) {
|
|
return null;
|
|
}
|
|
CampaignEx campaignEx = a2.get(0);
|
|
if (TextUtils.isEmpty(campaignEx.getAdZip()) && TextUtils.isEmpty(campaignEx.getAdHtml())) {
|
|
return null;
|
|
}
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
long j = currentTimeMillis - ac;
|
|
if (!z2) {
|
|
if (((campaignEx.getPlct() <= 0 || (campaignEx.getPlct() * 1000) + campaignEx.getTimestamp() < currentTimeMillis) && (campaignEx.getPlct() > 0 || campaignEx.getTimestamp() < j)) || !a(mBSplashView, campaignEx, str, str2, z, i, z3)) {
|
|
return null;
|
|
}
|
|
return a(campaignEx);
|
|
}
|
|
if ((campaignEx.getPlct() > 0 && (campaignEx.getPlct() * 1000) + campaignEx.getTimestamp() >= currentTimeMillis) || (campaignEx.getPlct() <= 0 && campaignEx.getTimestamp() >= j)) {
|
|
if (a(mBSplashView, campaignEx, str, str2, z, i, z3)) {
|
|
return a(campaignEx);
|
|
}
|
|
return null;
|
|
}
|
|
if (a(mBSplashView, campaignEx, str, str2, z, i, z3) && campaignEx.isSpareOffer(ac, ad)) {
|
|
return a(campaignEx);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private static CampaignEx a(CampaignEx campaignEx) {
|
|
if (!TextUtils.isEmpty(campaignEx.getAdZip()) || (!TextUtils.isEmpty(campaignEx.getAdHtml()) && campaignEx.getAdHtml().contains("<MBTPLMARK>"))) {
|
|
campaignEx.setHasMBTplMark(true);
|
|
campaignEx.setIsMraid(false);
|
|
} else {
|
|
campaignEx.setHasMBTplMark(false);
|
|
campaignEx.setIsMraid(true);
|
|
}
|
|
return campaignEx;
|
|
}
|
|
|
|
private static boolean a(MBSplashView mBSplashView, CampaignEx campaignEx, String str, String str2, boolean z, int i, boolean z2) {
|
|
boolean z3;
|
|
if (campaignEx == null) {
|
|
return false;
|
|
}
|
|
mBSplashView.clearResState();
|
|
if (TextUtils.isEmpty(campaignEx.getVideoUrlEncode())) {
|
|
z3 = true;
|
|
} else {
|
|
boolean z4 = mBSplashView.isVideoReady() || com.mbridge.msdk.videocommon.download.b.getInstance().a(297, str2, campaignEx.isBidCampaign());
|
|
if (!z4) {
|
|
a(mBSplashView, campaignEx, str2);
|
|
} else {
|
|
mBSplashView.setVideoReady(true);
|
|
}
|
|
z3 = z4;
|
|
}
|
|
if (!TextUtils.isEmpty(campaignEx.getAdZip()) && !mBSplashView.isH5Ready()) {
|
|
String h5ResAddress = H5DownLoadManager.getInstance().getH5ResAddress(campaignEx.getAdZip());
|
|
if (TextUtils.isEmpty(h5ResAddress)) {
|
|
z3 = false;
|
|
} else if (!z2) {
|
|
a(mBSplashView, h5ResAddress, campaignEx, str, str2, z, i);
|
|
}
|
|
}
|
|
if (TextUtils.isEmpty(campaignEx.getAdZip()) && !TextUtils.isEmpty(campaignEx.getAdHtml()) && !mBSplashView.isH5Ready()) {
|
|
String b2 = b(campaignEx.getAdHtml());
|
|
if (TextUtils.isEmpty(b2)) {
|
|
z3 = false;
|
|
} else if (!z2) {
|
|
a(mBSplashView, b2, campaignEx, str, str2, z, i);
|
|
}
|
|
}
|
|
if (campaignEx.isDynamicView()) {
|
|
if (TextUtils.isEmpty(campaignEx.getImageUrl()) || mBSplashView.isImageReady()) {
|
|
return false;
|
|
}
|
|
if (!com.mbridge.msdk.foundation.same.c.b.a(com.mbridge.msdk.foundation.controller.c.m().c()).b(campaignEx.getImageUrl())) {
|
|
a(mBSplashView, campaignEx, (com.mbridge.msdk.splash.view.nativeview.a) null);
|
|
} else {
|
|
mBSplashView.setImageReady(true);
|
|
return true;
|
|
}
|
|
}
|
|
return z3;
|
|
}
|
|
|
|
private static void a(final MBSplashView mBSplashView, CampaignEx campaignEx, String str) {
|
|
com.mbridge.msdk.videocommon.listener.a aVar = new com.mbridge.msdk.videocommon.listener.a() { // from class: com.mbridge.msdk.splash.c.d.1
|
|
@Override // com.mbridge.msdk.videocommon.listener.a
|
|
public final void a(String str2) {
|
|
MBSplashView.this.setVideoReady(true);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.videocommon.listener.a
|
|
public final void a(String str2, String str3) {
|
|
MBSplashView.this.setVideoReady(false);
|
|
}
|
|
};
|
|
CopyOnWriteArrayList<CampaignEx> copyOnWriteArrayList = new CopyOnWriteArrayList<>();
|
|
copyOnWriteArrayList.add(campaignEx);
|
|
com.mbridge.msdk.videocommon.download.b.getInstance().createUnitCache(com.mbridge.msdk.foundation.controller.c.m().c(), str, copyOnWriteArrayList, 297, aVar);
|
|
if (!com.mbridge.msdk.videocommon.download.b.getInstance().a(297, str, campaignEx.isBidCampaign())) {
|
|
com.mbridge.msdk.videocommon.download.b.getInstance().load(str);
|
|
} else {
|
|
mBSplashView.setVideoReady(true);
|
|
}
|
|
}
|
|
|
|
public static void a(final MBSplashView mBSplashView, CampaignEx campaignEx, final com.mbridge.msdk.splash.view.nativeview.a aVar) {
|
|
com.mbridge.msdk.foundation.same.c.b.a(com.mbridge.msdk.foundation.controller.c.m().c()).a(campaignEx.getImageUrl(), new com.mbridge.msdk.foundation.same.c.c() { // from class: com.mbridge.msdk.splash.c.d.2
|
|
@Override // com.mbridge.msdk.foundation.same.c.c
|
|
public final void onSuccessLoad(Bitmap bitmap, String str) {
|
|
com.mbridge.msdk.splash.view.nativeview.a aVar2 = com.mbridge.msdk.splash.view.nativeview.a.this;
|
|
if (aVar2 != null) {
|
|
aVar2.a();
|
|
}
|
|
MBSplashView mBSplashView2 = mBSplashView;
|
|
if (mBSplashView2 != null) {
|
|
mBSplashView2.setImageReady(true);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.same.c.c
|
|
public final void onFailedLoad(String str, String str2) {
|
|
com.mbridge.msdk.splash.view.nativeview.a aVar2 = com.mbridge.msdk.splash.view.nativeview.a.this;
|
|
if (aVar2 != null) {
|
|
aVar2.b();
|
|
}
|
|
MBSplashView mBSplashView2 = mBSplashView;
|
|
if (mBSplashView2 != null) {
|
|
mBSplashView2.setImageReady(false);
|
|
}
|
|
}
|
|
});
|
|
if (TextUtils.isEmpty(campaignEx.getIconUrl())) {
|
|
return;
|
|
}
|
|
com.mbridge.msdk.foundation.same.c.b.a(com.mbridge.msdk.foundation.controller.c.m().c()).a(campaignEx.getIconUrl(), new com.mbridge.msdk.foundation.same.c.c() { // from class: com.mbridge.msdk.splash.c.d.3
|
|
@Override // com.mbridge.msdk.foundation.same.c.c
|
|
public final void onFailedLoad(String str, String str2) {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.same.c.c
|
|
public final void onSuccessLoad(Bitmap bitmap, String str) {
|
|
}
|
|
});
|
|
}
|
|
|
|
private static void a(MBSplashView mBSplashView, String str, CampaignEx campaignEx, String str2, String str3, boolean z, int i) {
|
|
g gVar;
|
|
g.c cVar = new g.c();
|
|
cVar.c(str3);
|
|
cVar.b(str2);
|
|
cVar.a(campaignEx);
|
|
cVar.a(str);
|
|
cVar.a(z);
|
|
cVar.a(i);
|
|
gVar = g.a.a;
|
|
gVar.a(mBSplashView, cVar, null);
|
|
}
|
|
|
|
private static String b(String str) {
|
|
try {
|
|
File file = new File(str);
|
|
if (!file.exists()) {
|
|
return "";
|
|
}
|
|
return "file:///" + file.getAbsolutePath();
|
|
} catch (Throwable th) {
|
|
try {
|
|
throw th;
|
|
} catch (Exception e) {
|
|
e.getMessage();
|
|
return "";
|
|
}
|
|
}
|
|
}
|
|
|
|
public static boolean a(MBSplashView mBSplashView, CampaignEx campaignEx) {
|
|
if (mBSplashView == null) {
|
|
return false;
|
|
}
|
|
boolean isVideoReady = !TextUtils.isEmpty(campaignEx.getVideoUrlEncode()) ? mBSplashView.isVideoReady() : true;
|
|
if (isVideoReady && !TextUtils.isEmpty(campaignEx.getAdZip())) {
|
|
isVideoReady = mBSplashView.isH5Ready();
|
|
}
|
|
if (isVideoReady && TextUtils.isEmpty(campaignEx.getAdZip()) && !TextUtils.isEmpty(campaignEx.getAdHtml())) {
|
|
isVideoReady = mBSplashView.isH5Ready();
|
|
}
|
|
if (TextUtils.isEmpty(campaignEx.getAdZip()) && TextUtils.isEmpty(campaignEx.getAdHtml())) {
|
|
isVideoReady = false;
|
|
}
|
|
if (!campaignEx.isDynamicView()) {
|
|
return isVideoReady;
|
|
}
|
|
if (TextUtils.isEmpty(campaignEx.getImageUrl())) {
|
|
return false;
|
|
}
|
|
return mBSplashView.isImageReady();
|
|
}
|
|
|
|
public static void a(CampaignEx campaignEx, String str) {
|
|
ArrayList arrayList = new ArrayList();
|
|
arrayList.add(campaignEx);
|
|
if (a == null) {
|
|
a = com.mbridge.msdk.foundation.db.e.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.c.m().c()));
|
|
}
|
|
a.b(arrayList, str);
|
|
}
|
|
|
|
public static void a(String str) {
|
|
if (a == null) {
|
|
a = com.mbridge.msdk.foundation.db.e.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.c.m().c()));
|
|
}
|
|
a.a(str, 0, c);
|
|
}
|
|
}
|