玖星尚缘 v1.2.7版本的 MD5 值为:a5d3a854f0a33133433102e91a1193e3
以下内容为反编译后的 a.java 源代码,内容仅作参考
package io.dcloud.h.c.c.e;
import android.app.Activity;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import com.taobao.weex.performance.WXInstanceApm;
import io.dcloud.sdk.core.module.DCBaseAOL;
import io.dcloud.sdk.core.module.DCBaseAOLLoader;
import io.dcloud.sdk.core.util.AdErrorUtil;
import io.dcloud.sdk.poly.base.utils.a;
import io.dcloud.sdk.poly.base.utils.d;
import io.dcloud.sdk.poly.base.utils.e;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.json.JSONArray;
public abstract class a extends c implements io.dcloud.h.c.c.f.b.d.a {
private final List<io.dcloud.h.c.c.f.b.d.b> f;
private final List<io.dcloud.h.c.c.f.b.d.b> g;
private io.dcloud.h.c.c.f.b.d.b h;
private boolean i;
private final Handler j;
private final int k;
private final int l;
private long m;
private String n;
private boolean o;
private io.dcloud.h.c.c.a.b p;
private Set<String> q;
public interface InterfaceC0109a {
void a(DCBaseAOLLoader dCBaseAOLLoader, io.dcloud.h.c.c.a.c cVar);
void a(DCBaseAOLLoader dCBaseAOLLoader, List<? extends DCBaseAOL> list, io.dcloud.h.c.c.a.c cVar);
}
private class b extends Handler {
public b(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message message) {
a.this.j();
}
}
public a(Activity activity) {
super(activity);
this.f = new ArrayList();
this.g = new ArrayList();
this.i = false;
this.k = 3;
this.l = 18000;
this.m = 0L;
this.n = "";
this.o = false;
this.q = new HashSet();
this.j = new b(d.a().getLooper());
}
private void f() {
long elapsedRealtime = SystemClock.elapsedRealtime() - this.m;
ArrayList<io.dcloud.h.c.c.a.c> arrayList = new ArrayList();
for (io.dcloud.h.c.c.f.b.d.b bVar : this.g) {
arrayList.addAll(bVar.g());
}
JSONArray jSONArray = new JSONArray();
if (arrayList.size() > 0) {
JSONArray jSONArray2 = new JSONArray();
for (io.dcloud.h.c.c.a.c cVar : arrayList) {
if (cVar.e()) {
if (this.q.contains(cVar.c())) {
cVar.f();
}
if (cVar.d() == 0) {
jSONArray.put(cVar.b());
}
jSONArray2.put(cVar.g());
}
}
e.b("collection data:load time:" + elapsedRealtime);
a(this.d, this.b.getAdpid(), this.p.g() ? "1" : WXInstanceApm.VALUE_ERROR_CODE_DEFAULT, this.b.getEI(), jSONArray2, elapsedRealtime);
}
a(jSONArray);
}
private void h() {
long e = this.p.e() - (SystemClock.elapsedRealtime() - this.m);
if (e <= 0) {
c(-5018, AdErrorUtil.getErrorMsg(-5018));
return;
}
this.j.removeMessages(3);
this.j.sendEmptyMessageDelayed(3, e);
if (this.d != this.p.f()) {
c(-5011, AdErrorUtil.getErrorMsg(-5011));
return;
}
List<io.dcloud.h.c.c.a.d> d = this.p.d();
if (d != null && !d.isEmpty()) {
if (this.d != 1 && Collections.disjoint(io.dcloud.sdk.core.b.a.b().a().keySet(), this.p.b())) {
c(-5012, AdErrorUtil.getErrorMsg(-5012));
return;
} else if (a(this.p, d)) {
return;
} else {
e.a("level load finish.total:" + this.f.size());
for (io.dcloud.h.c.c.f.b.d.b bVar : this.f) {
e.a(bVar.toString());
}
i();
return;
}
}
c(-5019, AdErrorUtil.getErrorMsg(-5019));
}
private void i() {
if (this.f.size() > 0 && !this.i) {
io.dcloud.h.c.c.f.b.d.b remove = this.f.remove(0);
io.dcloud.h.c.c.f.b.d.b bVar = this.h;
if (bVar != null && bVar.c() > 0) {
boolean b2 = remove.b(this.h.c());
e.a("is necessary to load next:" + b2 + ",next level:" + remove.f());
if (!remove.b(this.h.c())) {
i();
return;
}
remove.e(this.h.c());
this.g.add(remove);
remove.a(this.n);
remove.a();
return;
}
this.g.add(remove);
remove.a(this.n);
remove.a();
return;
}
io.dcloud.h.c.c.f.b.d.b bVar2 = this.h;
if (bVar2 != null) {
((io.dcloud.h.c.c.f.a.a) bVar2).j();
b(this.h.i());
}
f();
}
public void j() {
this.i = true;
e.b("this slot:time out");
if (this.g.isEmpty()) {
a(new JSONArray());
return;
}
for (io.dcloud.h.c.c.f.b.d.b bVar : this.g) {
if (!bVar.k()) {
bVar.h();
}
}
}
protected abstract void a(int i, String str, JSONArray jSONArray);
@Override
public DCBaseAOLLoader b() {
return null;
}
@Override
public void b(io.dcloud.h.c.c.f.b.d.b bVar) {
e.a("level load success.current:" + bVar.f() + ",is bid:" + bVar.d());
if (bVar.d()) {
this.h = bVar;
i();
return;
}
io.dcloud.h.c.c.f.b.d.b bVar2 = this.h;
if (bVar2 != null && (bVar2 instanceof io.dcloud.h.c.c.f.a.a)) {
if (g()) {
a.C0128a a = io.dcloud.sdk.poly.base.utils.a.a(this.b.getCount(), this.h.i(), bVar.i());
if (a == null) {
this.h = null;
i();
return;
}
for (DCBaseAOL dCBaseAOL : a.d) {
if (dCBaseAOL.isSlotSupportBidding()) {
dCBaseAOL.biddingSuccess(a.b, a.c);
}
}
b(a.d);
} else if (bVar.c() > this.h.c()) {
((io.dcloud.h.c.c.f.a.a) this.h).d(bVar.c());
b(bVar.i());
} else {
((io.dcloud.h.c.c.f.a.a) this.h).j();
b(this.h.i());
}
} else {
b(bVar.i());
}
f();
}
protected abstract void c(List<DCBaseAOL> list);
@Override
protected boolean c() {
return 1 == this.p.c();
}
boolean g() {
int i = this.d;
return i == 10 || i == 4;
}
@Override
public void run() {
this.n = UUID.randomUUID().toString();
this.g.clear();
this.f.clear();
this.q.clear();
this.h = null;
this.i = false;
this.o = false;
if (this.d != 1) {
Set<String> keySet = io.dcloud.sdk.core.b.a.b().a().keySet();
if (keySet.isEmpty() || (keySet.size() == 1 && keySet.contains("dcloud"))) {
c(-5004, AdErrorUtil.getErrorMsg(-5004));
return;
}
}
this.j.sendEmptyMessageDelayed(3, 18000L);
this.m = SystemClock.elapsedRealtime();
super.run();
}
private void c(int i, String str) {
b(i, str, null);
}
@Override
public void a(io.dcloud.h.c.c.a.b bVar) {
this.p = bVar;
this.b.setAdpid(bVar.a());
h();
}
@Override
public void a(int i, String str) {
b(i, str, null);
}
private boolean a(io.dcloud.h.c.c.a.b bVar, List<io.dcloud.h.c.c.a.d> list) {
HashMap hashMap = new HashMap();
io.dcloud.h.c.c.f.b.a aVar = null;
for (io.dcloud.h.c.c.a.d dVar : list) {
int e = dVar.e();
if (dVar.r()) {
if (aVar == null) {
aVar = new io.dcloud.h.c.c.f.b.a(this.b, this.c);
aVar.c(bVar.f());
if (bVar.g()) {
aVar.e();
}
}
aVar.a(e);
aVar.a(dVar);
} else {
io.dcloud.h.c.c.f.b.d.b bVar2 = (io.dcloud.h.c.c.f.b.d.b) hashMap.get(Integer.valueOf(e));
if (bVar2 != null) {
bVar2.a(dVar);
} else {
io.dcloud.h.c.c.f.b.c cVar = new io.dcloud.h.c.c.f.b.c(this.b, this.c);
if (bVar.g()) {
cVar.e();
}
cVar.c(bVar.f());
cVar.a(this);
cVar.a(dVar.e());
cVar.a(dVar);
hashMap.put(Integer.valueOf(dVar.e()), cVar);
}
}
}
if (aVar != null) {
if (hashMap.containsKey(Integer.valueOf(aVar.f()))) {
io.dcloud.h.c.c.f.b.b bVar3 = new io.dcloud.h.c.c.f.b.b(this.b, this.c);
bVar3.a(aVar);
bVar3.a((io.dcloud.h.c.c.f.b.c) hashMap.get(Integer.valueOf(aVar.f())));
bVar3.a(aVar.f());
bVar3.a(this);
bVar3.c(bVar.f());
if (bVar.g()) {
bVar3.e();
}
hashMap.put(Integer.valueOf(aVar.f()), bVar3);
} else {
aVar.a(this);
hashMap.put(Integer.valueOf(aVar.f()), aVar);
}
}
this.f.addAll(hashMap.values());
if (this.f.size() > 1) {
Collections.sort(this.f, new Comparator() {
@Override
public final int compare(Object obj, Object obj2) {
int a;
a = a.a((io.dcloud.h.c.c.f.b.d.b) obj, (io.dcloud.h.c.c.f.b.d.b) obj2);
return a;
}
});
return false;
} else if (hashMap.size() == 1) {
return false;
} else {
c(-5020, AdErrorUtil.getErrorMsg(-5020));
return true;
}
}
private void b(int i, String str, JSONArray jSONArray) {
if (this.o) {
return;
}
this.o = true;
e.b("this slot:all fail");
this.j.removeMessages(3);
a(i, str, jSONArray);
}
private void b(List<DCBaseAOL> list) {
if (this.o) {
return;
}
this.o = true;
int i = 0;
if (io.dcloud.sdk.poly.base.utils.b.a) {
for (DCBaseAOL dCBaseAOL : list) {
e.a("success!index:" + i + ";ad:" + dCBaseAOL.toString() + ";type:" + dCBaseAOL.getType() + ",id:" + dCBaseAOL.getSlotId());
i++;
}
}
this.j.removeMessages(3);
a(list);
}
public static int a(io.dcloud.h.c.c.f.b.d.b bVar, io.dcloud.h.c.c.f.b.d.b bVar2) {
return Integer.compare(bVar.f(), bVar2.f());
}
@Override
public Activity a() {
return this.c;
}
@Override
public void a(io.dcloud.h.c.c.f.b.d.b bVar) {
i();
}
private void a(JSONArray jSONArray) {
if (this.i) {
b(-5018, AdErrorUtil.getErrorMsg(-5018), jSONArray);
} else {
b(-5005, AdErrorUtil.getErrorMsg(-5005), jSONArray);
}
}
private void a(List<DCBaseAOL> list) {
if (list.size() > 0) {
for (DCBaseAOL dCBaseAOL : list) {
this.q.add(dCBaseAOL.getSlotId());
}
}
c(list);
}
}